Datatable group and pages
Datatable group and pages
![gandalf_ch](https://secure.gravatar.com/avatar/0b984f5d649ec4f53d83b2ca4b34a162/?default=https%3A%2F%2Fvanillicon.com%2F0b984f5d649ec4f53d83b2ca4b34a162_200.png&rating=g&size=120)
Hi, I'm new in datatables and I'm trying to group records to allow a "check all in group" feature.
For this I make a group on rendering:
startRender: function(rows, group) {
var x = \"".str_replace(' ','_',$tmp[1])."_\"+ group.replace(/ /g,\"_\");
if($('#'+ x).length==0){
rows.every(function(rowIdx, tableLoop, rowLoop) {
var rowData = this.data();
$(this.node()).addClass(group.replace(/[^A-Za-z0-9]/g, ''));
});
var x = \"".str_replace(' ','_',$tmp[1])."_\"+ group.replace(/ /g,\"_\");
return \"<div class='checkbox checkbox-success'><input id=\"+ x +\" type='checkbox' class='company-group' value='\" +
group.replace(/[^A-Za-z0-9]/g, '') + \"'/><label for='\" + x + \"'>\" + group + ' (' + rows.count() + ')</label>'+
'</div>';
}
}":"")."
I've the grouping working well, but the problem is that I've the same grouping checkbox in all pages. I've 10 records by page, if a group has 30 records, I get this grouping on second and third page as well. How to get the grouping only on page 1 and not repeating on next pages if I've already ? If there is a second group on record 35, I should have the grouping on page 3 obviously. Thank you for help.
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
Hi,
I'm afraid that showing the grouping header on the other pages, to indicate the continued group, is part of how RowGroup works and there isn't an option to disable that I'm afraid.
Consider this example for illustration. You'll note that there is a "London" group on the first page, and then go to page 2, "London" grouping is shown again. And again for a single row on page 3.
I do understand what you are looking for, but I'm afraid that's not how RowGroup currently works.
Allan