Row Grouping - fnAddData to previous gruop
Row Grouping - fnAddData to previous gruop
Hi,
I was looking for a way to group rows and found your example in the docs. It works great if I add rows linearly but If I have to add a row to a group (using fnAddData) already created it creates a new group. Looking at the code I can why, but what changes would I have to make for this functionality?
Thanks
I was looking for a way to group rows and found your example in the docs. It works great if I add rows linearly but If I have to add a row to a group (using fnAddData) already created it creates a new group. Looking at the code I can why, but what changes would I have to make for this functionality?
Thanks
This discussion has been closed.
Replies
If that doesn't help perhaps you can post an example showing the problem.
Allan
I don't think I was clear in my first post, sorry. Here's what I'm doing.
1) I start with a blank table.
2) fnAddData with a group identifier of group1 - creates a new group like it should
3) fnAddData with a group id of group1 - adds it to existing group correctly
4) fnAddData with a group id of group2 - correctly creates a new group and adds it to it
5) fnAddData with a group id of group1 again - it will create another group1 rather than adding to the original group1
It looks to me like this is because when you check to see if you should add a new group "if ( sGroup != sLastGroup )" you are only checking against the last group creation and not any before. I hope this clarifies.
Thanks
Regards,
Allan
Regards,
Allan
Using the code from the example I set bSort to true, used aaFixedSorting on the group column, and turned of sorting on all other columns. Works perfectly now.
Also I think there's a small error in that code. You have "var i = 0;" above the for loop, thats not needed right?
Thanks again,
Kyprus
Good to hear you got it "sorted" :-). Thanks for picking up my little typo in the demo code as well - I've corrected that now.
Regards,
Allan