about restore pagination of DataTables
about restore pagination of DataTables
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
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
This discussion has been closed.
Replies
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
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!
Edit: Never mind I forgot my developers did EVERYTHING server-side...