Group index
Group index
srgloureiro
Posts: 7Questions: 2Answers: 0
Is there a way to get the group index on the startRender event? I need in each row to get on what group number I am currently.
Answers
See the
rowGroup.startRender
docs for all the parameters passed into the function. Sounds like you are wanting thegroup
parameter.Kevin
@kthorngren This is not what I want.
What I want is an index of the group, not its title.
I ended up implementing a solution each time the
startRender
runs, incrementing an iterator counter, based on thatgroup
title text, comparing it to the previous one.Not an approach I like very much, but it works.
I don't believe
rowGroup.startRender
has an index. Its not really something Datatables tracks as part of the table data. It just insertstr
elements into the HTML table for display. Maybe you can describe what you are trying to do to see if there is another option.EDIT: Note that the
rowGroup.startRender
only groups the rows that are displayed on the page not all rows in the table. So the groups processed on one page might different on the next page.Kevin
In my case, I don't have pagination, and even if I had, I would only need it for current page.
Thanks any way.
If we were to take this example, do you mean you would want the
startRender
for "Edinburgh" to be passed in 0, for "London" 1, "New York" 2, etc? Or something else?Allan
@allan Yes. And in my case I needed it for sub-groups, so I did reset the counter every timed I entered a new group.