Finding page and row when using bDeferRender on large dataset

Finding page and row when using bDeferRender on large dataset

rvgrahamrvgraham Posts: 28Questions: 5Answers: 0
edited January 2014 in General
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

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited January 2014
    Hi Bob,

    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
  • rvgrahamrvgraham Posts: 28Questions: 5Answers: 0
    edited January 2014
    I will try that. Are there any breaking changes in 1.10? I will research that myself, but any feedback would be great. I use RowGrouping (modified a bit), and a lot of events registered to tr cells (edit in place and the like).

    Thanks, Bob
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Two breaking changes - fnRender and bScrollInfinite have been removed. They were (franky) holding DataTables back, technically - it would have been hard to push on with them. mRender is in place of fnRender and bScrollInfinite has Scroller to replace it now.

    I haven't tried the rowGrouping plug-in though...

    Allan
This discussion has been closed.