Finding page and row when using bDeferRender on large dataset
Finding page and row when using bDeferRender on large dataset
So I have bDeferRender = true because I add a lot of click events and customization to cells on each row. Without this the performance is unacceptable. However, where I used to use fnDisplayRow to jump to newly added rows (I have a "clone records" feature in my app), this no longer works as fnGetNodes only returns the currently displayed rows.
fnGetData seems to have all rows available, but they may have sorted the table non-standard by the time my code may need to jump directly to another page and highlight a row to show the user where the new or changed row is.
Is there a way I can do some math on fnGetData() to determine what to set as iDisplayStart without turning off bDeferRender? Even if I don't know how they may have altered the sorting?
Thanks, Bob Graham
fnGetData seems to have all rows available, but they may have sorted the table non-standard by the time my code may need to jump directly to another page and highlight a row to show the user where the new or changed row is.
Is there a way I can do some math on fnGetData() to determine what to set as iDisplayStart without turning off bDeferRender? Even if I don't know how they may have altered the sorting?
Thanks, Bob Graham
This discussion has been closed.
Replies
Are you willing to use DataTables 1.10?
You could try:
[code]
var table = $('#myTable').DataTable();
var pos = $.inArray( myValue, table.column(0, {order:'current'}).data() );
var page = Math.floor( pos / table.page.info().length );
table.page( page ).draw( false );
[/code]
As a little plug-in:
[code]
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( column, data ) {
var pos = this.column(column, {order:'current'}).data().indexOf( data );
if ( pos >= 0 ) {
var page = Math.floor( pos / this.page.info().length );
this.page( page ).draw( false );
}
} );
[/code]
Allan
Thanks, Bob
I haven't tried the rowGrouping plug-in though...
Allan