After updating a datatable row return to the page where the row belongs.
After updating a datatable row return to the page where the row belongs.
Suppose I have a table with many rows and by clicking to i.e. page 40 I update a row through my application's menu.
I would like to know how I should handle such a situation so that after the row's update to be able to return to the page where the row was found. How can I achieve that? Any example? My project is a Laravel project if this helps at all.
Thanks
This question has an accepted answers - jump to answer
Answers
Sounds like you are using
draw()orajax.reload()as part of the updated process. You can pass in a paging parameter to both API's to control staying on the same page. Pass infalseas the first aprameter todraw()or the second parameter toajax.reload().If this doesn't help then at a minimum post the to being used to update the row. Better is a link to a test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Just thought of this. If the row is updated and sorting places is on a different page you can use either the page.jumpToData() or row().show() plugin to jump to the page containing that row.
Kevin
I think you are spot on, Kevin. The row().show() plugin does this very nicely.
I've been using it frequently. Here is an example that should do the job.
A row that was updated must have been selected before. That's the trick. Of course that only works with "singleSelect". If you are allowing to edit multiple records at the same time, you might face some headwind.
I guess these all are done by using Ajax calls. Is there any documentation on this subject? Is there any documentation on how to apply Datatables Ajax calls in Laravel?
Well it depends on what your requirements are. The updates can be made just client side. However most cases will use a jQuery ajax() request to update the server. If you are using theEditor the ajax requests are built into the configuration. See the Editor examples.
Not on this site. If you are using the Yarja Larvel library please refer to their documentation and support for questions.
Again please post your code so we can wee what you have and provide specific questions/requirements so we can offer more specific answers.
Kevinw