DataTables Editor with previous / next buttons + fnFilter
DataTables Editor with previous / next buttons + fnFilter
I would like to use Previous/Next buttons on the Editor but I also use fnFilter to limit the number of rows to display.
Unfortunately, with the Previous/Next I jump to the next in the database without any consideration to the fnFilter.
Could you tell me if I have to add this fnFilter somewhere else in aButtons or if this is just a bug ?
http://editor.datatables.net/release/DataTables/extras/Editor/examples/back-next.html
Thanks
Sev
Unfortunately, with the Previous/Next I jump to the next in the database without any consideration to the fnFilter.
Could you tell me if I have to add this fnFilter somewhere else in aButtons or if this is just a bug ?
http://editor.datatables.net/release/DataTables/extras/Editor/examples/back-next.html
Thanks
Sev
This discussion has been closed.
Replies
This is the key piece of code:
> table.$('tr')[index+1]
That uses the `$` method ( http://datatables.net/docs/DataTables/1.9.4/DataTable.html#$ ) to get the next row. As you'll be able to see from the documentation, by default `$` does not take into account filtering, but you can easily make it do so:
[code]
table.$('tr', {filter:'applied'})[index+1]
[/code]
Likewise for the 'previous' button and that should do it.
Regards,
Allan
[code] var index = table.$('tr', {"filter": "applied"}).index(row);[/code]
and
[code] tt.fnSelect( table.$('tr', {"filter": "applied"})[index-1] );[/code]