Paging with Row Grouping
Paging with Row Grouping
Chunk
Posts: 1Questions: 0Answers: 0
Hi, I've followed this example to add grouping rows to my table:
http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html
It works well, but when you apply paging, it displays iDisplayLength number of rows plus the added grouping rows.
What's the best way to make it show iDisplayLength number of rows including the grouping rows?
Apologies if it's a stupid question, this is my first foray into the world of JQuery.
Any help would be appreciated.
[code]
$('#new_1').dataTable({
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('tbody tr', oSettings.nTable);
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
var sLastGroup1 = "";
for ( var i=0 ; i
http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html
It works well, but when you apply paging, it displays iDisplayLength number of rows plus the added grouping rows.
What's the best way to make it show iDisplayLength number of rows including the grouping rows?
Apologies if it's a stupid question, this is my first foray into the world of JQuery.
Any help would be appreciated.
[code]
$('#new_1').dataTable({
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('tbody tr', oSettings.nTable);
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
var sLastGroup1 = "";
for ( var i=0 ; i
This discussion has been closed.
Replies
[code]
groupTableRows = function(oSettings){
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('> tbody > tr', oSettings.nTable);
var $table = $(oSettings.nTable );
var index = oSettings._iDisplayStart + nTrs.length -1;
if (index+1 < oSettings.aiDisplay.length && !$table.hasClass('group-processed')){
var sLastGroup = oSettings.aoData[ oSettings.aiDisplay[index]]._aData[0];
var missing_rows = 0;
for ( var j=index+1 ; j 0){
oSettings._iDisplayLength = nTrs.length + missing_rows;
$table.addClass('group-processed');
return $table.dataTable().fnDraw(oSettings);
}
}
//Grouping Code
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i