Rowgroup with dynamic source and making group header a link

Rowgroup with dynamic source and making group header a link

locrian1288locrian1288 Posts: 2Questions: 1Answers: 0

Hello, I am trying to figure out if it is possible to make a rowgroup header a link when the rowgroups are dynamic. I know on table draw I can use startRender to make the link which I had working but the needs changed to requiring dynamic grouping. I have the source change working but one of my columns will contain a link to a specific record which I would like to be represented if the user chooses that column to group.

To clean up data the column selected to group by is hidden so the link is not available per row to the user hence the need for the group header to contain the link instead.

basically I am looking for a way to loop through the group headers, then find the first child row of that header, access the data/cell that has the link and replace the group header with that cells text.

I have been able to get close looping through the class ".dtrg-group" but I dont know how to get the data from the table for the hidden column after finding this row. And Im concerned that if I base the logic off a class that in the future a change to the rowgroup api could cause problems.

Here is a sample fiddle. I have been using the "Check Headers" button to try and change the headers https://jsfiddle.net/locrian1288/hf0t5w94/77/

Is this possible?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    Answer ✓

    The rowGroup.startRender has a rows parameter which contains the indexes for all the rows in the group. If I understand correctly you want to access the first row of the group to generate the link. You can do that with row().data() using rows[0] as the row-selector. I think this updated example is what you are asking for:
    https://jsfiddle.net/rh6bmpkj/

    Kevin

  • locrian1288locrian1288 Posts: 2Questions: 1Answers: 0

    Oh, you're a hero! It was really that easy?

    I didnt realize that the startRender would be triggered every time it changed. That was so much easier than I thought it would be.

    I appreciate your time and explanation!

Sign In or Register to comment.