1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-30 23:52:11 +01:00

Example - update: Use $ and fnUpdate in the index column example - 9840

This commit is contained in:
Allan Jardine 2012-05-10 18:52:25 +01:00
parent b64dda47c3
commit 90edd0bd94

View File

@ -15,13 +15,14 @@
$(document).ready(function() { $(document).ready(function() {
$('#example').dataTable( { $('#example').dataTable( {
"fnDrawCallback": function ( oSettings ) { "fnDrawCallback": function ( oSettings ) {
var that = this;
/* Need to redo the counters if filtered or sorted */ /* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered ) if ( oSettings.bSorted || oSettings.bFiltered )
{ {
for ( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ ) this.$('td:first-child', {"filter":"applied"}).each( function (i) {
{ that.fnUpdate( i+1, this.parentNode, 0, false, false );
$('td:eq(0)', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr ).html( i+1 ); } );
}
} }
}, },
"aoColumnDefs": [ "aoColumnDefs": [
@ -539,10 +540,9 @@
/* Need to redo the counters if filtered or sorted */ /* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered ) if ( oSettings.bSorted || oSettings.bFiltered )
{ {
for ( var i=0, iLen=oSettings.aiDisplay.length ; i&lt;iLen ; i++ ) this.$('td:first-child', {"filter":"applied"}).each( function (i) {
{ that.fnUpdate( i+1, this.parentNode, 0, false, false );
$('td:eq(0)', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr ).html( i+1 ); } );
}
} }
}, },
"aoColumnDefs": [ "aoColumnDefs": [