≡
×
Plus
Manual
Examples
Reference
Download
Blog
Community
Support
Row grouping datatables
Row grouping datatables
Saran
Posts: 3
Questions: 0
Answers: 0
August 2010
edited August 2010
in
General
Hi Allan,
I'm trying to combine both row grouping and row expansion functionalities in single datatable. But datatable Stability ends when i go for sorting!
Thanks
Saran
Replies
Saran
Posts: 3
Questions: 0
Answers: 0
August 2010
edited August 2010
my references are
http://datatables.net/examples/advanced_init/row_grouping.html
http://datatables.net/examples/api/row_details.html
Thanks
Saran
Saran
Posts: 3
Questions: 0
Answers: 0
August 2010
edited August 2010
Here is my code. help me to fix this.
[code]
/* Formating function for row details */
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Data1Data2';
sOut += 'randy500';
sOut += 'richard300';
sOut += '';
return sOut;
}
$(document).ready(function() {
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '';
nCloneTd.className = "center";
$('#example thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );
$('#example tbody tr').each( function () {
this.insertBefore( nCloneTd.cloneNode( true ), this.childNodes[0] );
} );
var oTable = $('#example').dataTable({
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('#example tbody tr');
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i
This discussion has been closed.
Replies
http://datatables.net/examples/advanced_init/row_grouping.html
http://datatables.net/examples/api/row_details.html
Thanks
Saran
[code]
/* Formating function for row details */
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Data1Data2';
sOut += 'randy500';
sOut += 'richard300';
sOut += '';
return sOut;
}
$(document).ready(function() {
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '';
nCloneTd.className = "center";
$('#example thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );
$('#example tbody tr').each( function () {
this.insertBefore( nCloneTd.cloneNode( true ), this.childNodes[0] );
} );
var oTable = $('#example').dataTable({
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('#example tbody tr');
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i