about restore pagination of DataTables

about restore pagination of DataTables

alsukaalsuka Posts: 2Questions: 0Answers: 0
edited January 2010 in General
hi,

In my work, I take DateTables to do marking and checked of datalist.
The screenshot of table please view here: http://honda.twbbs.org/img/jq_dt.jpg
( number and checkbox in read line rectangle )

Now I got a problem.
In some user event, I need to reset each number of recordes sequentially.
Another Scenario is the javascript have to clean all checked recordes.

Both of two situation can only do one page's clean/reset action.
So I wanna know DataTables has any way can help this issue?
Like expand all paginations to one page ( then I can scripting easily)
Or some API function can resolve my question.

thank you vary much for your replay! m(_ _)m

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi alsuka,

    To display all records on a single "page" you can set the _iDisplayLength property to -1 and redraw the table (e.g. oTable.fnSettings()._iDisplayLength=-1; ). This can also be done manually using the drop down menu for the user: http://datatables.net/usage/i18n#oLanguage.sLengthMenu

    You might want to also have a look at this thread for checking/unchecking all boxes in a DataTable without altering the display: http://datatables.net/forums/comments.php?DiscussionID=1072

    Regards,
    Allan
  • alsukaalsuka Posts: 2Questions: 0Answers: 0
    edited January 2010
    Hi allan,

    Now I know how to use http://datatables.net/api#fnGetNodes .

    In clean action:
    $(oTable.fnGetNodes()).find(":checkbox").attr('checked',false);
    or
    $(':checkbox', oTable.fnGetNodes()).attr('checked',false);

    Both can work.

    Another assign number action:

    I put this code in function _fnDraw( oSettings ){
    ...
    $(oSettings.aoData).each(function(i) //update when resort and switch page
    {
    ? $(this.nTr).find('.num').text(this.nTr.rowIndex+oSettings._iDisplayStart);
    });
    ps. row > tr have one span which class is num

    Then it will mark number when user do sort event.
    => update @ 20100111
    In order to maintain code easily. It should use fnRowCallback.
    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
    $(nRow).find('.num').html( 1+iDisplayIndex+ this._iDisplayStart );
    return nRow;
    }

    thanks!
  • TomCTomC Posts: 43Questions: 0Answers: 0
    edited August 2010
    I am trying to show all entres at once and I am having trouble getting -1 to work as a select value. Does that work with all versions of DataTable?

    Edit: Never mind I forgot my developers did EVERYTHING server-side...
This discussion has been closed.