Re-page after removing a row
Re-page after removing a row
tor
Posts: 3Questions: 0Answers: 0
I swear I've looked everywhere and can't find the answer.
Let's say I use .fnDeleteRow to remove a row. Now my page has 9 rows. How do I bump the next row from the next page in? AKA, how do I quickly re-paginate after changing DataTables' rows? Do I need to push this changed data back into the table's value and then force a redraw?
Thanks
Let's say I use .fnDeleteRow to remove a row. Now my page has 9 rows. How do I bump the next row from the next page in? AKA, how do I quickly re-paginate after changing DataTables' rows? Do I need to push this changed data back into the table's value and then force a redraw?
Thanks
This discussion has been closed.
Replies
Allan
If you hit http://torrobinson.com/test/public/stats/edit and log in with "allan", password "123123". Then when you are redirected, pick the first menu item from the dropdown. Info from my db is loaded in, including a bunch if line items into a Datatables.js table (the Date/Value/Actions table).
Each line has a little red delete button. When this is clicked (and maybe you can see my javascript if you inspect with Chrome) I grab that tr:
[code] var tr = $(this).parents('tr').first();[/code]
Then I delete it:
[code]statTable.fnDeleteRow(tr);[/code]
It vanishes as expected, but paging doesn't go anywhere. I haven't yet implemented actually hitting the db first to try perform a successful deletion, I'm just trying to get it to display right first.
I'm initializing the table with these options:
[code] var statTable = $('#statTable').dataTable({
"bFilter": false,
"bLengthChange": false,
"aaSorting": [],
"fnDrawCallback": null,
"iDisplayLength":10
});[/code]
Is there anything wrong with my initialization and row deletion?
Note that when the page gets down to 1 row left, then it fills back to always have 1 row, not 10, and the total count never changes,
Thanks so much
EDIT: Please note I havent begun rebinding these delete buttons on page changes. I want to see first that I can enter on the 1st page, delete a row, and watch the page refill to 10 and the count go down by one. In other words, if you change to page 2, the delete button wont function.