Quantcast
Viewing all articles
Browse latest Browse all 82132

DataTables row grouping example with fixed Column

Hi,

I have an error when I try to use row grouping (available here : http://www.datatables.net/release-datatables/examples/advanced_init/row_grouping.html) and FixedColumns plugin.

I have the following code for this example :
$(document).ready(function() {
	oTable = $('#example').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 = "";
			for ( var i=0 ; i<nTrs.length ; i++ )
			{
				var iDisplayIndex = oSettings._iDisplayStart + i;
				var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
				if ( sGroup != sLastGroup )
				{
					var nGroup = document.createElement( 'tr' );
					var nCell = document.createElement( 'td' );
					nCell.colSpan = iColspan;
					nCell.className = "group";
					nCell.innerHTML = sGroup;
					nGroup.appendChild( nCell );
					nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
					sLastGroup = sGroup;
				}
			}
		},
		"aoColumnDefs": [
			{ "bVisible": false, "aTargets": [ 0 ] }
		],
		"sScrollY": "850px",
		"sScrollX": "150%",
		"aaSortingFixed": [[ 0, 'asc' ]],
		"aaSorting": [[ 1, 'asc' ]],
		"iDisplayLength": 100,
		"sDom": 'lfr<"giveHeight"t>ip'
	});
	
	new FixedColumns( oTable,{} );
} );


But this error occured :

that.s.dt.aoData[i] is undefined
FixedColumns.js (ligne 865) => if ( typeof that.s.dt.aoData[i]._anHidden[iColumn] != 'undefined' )

Could you help me to understand and fixed this error please?

Thanks for your help.

Regards

Viewing all articles
Browse latest Browse all 82132

Trending Articles