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.

adamnetadamnet Posts: 7Questions: 5Answers: 0

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

  • kthorngrenkthorngren Posts: 22,340Questions: 26Answers: 5,136

    Sounds like you are using draw() or ajax.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 in false as the first aprameter to draw() or the second parameter to ajax.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

  • kthorngrenkthorngren Posts: 22,340Questions: 26Answers: 5,136

    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

  • rf1234rf1234 Posts: 3,189Questions: 92Answers: 438
    edited November 19

    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?

    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.

    after the row's update to be able to return to the page where the row was found.

    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.

  • adamnetadamnet Posts: 7Questions: 5Answers: 0

    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?

  • kthorngrenkthorngren Posts: 22,340Questions: 26Answers: 5,136
    Answer ✓

    I guess these all are done by using Ajax calls

    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.

    Is there any documentation on how to apply Datatables Ajax calls in Laravel?

    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

Sign In or Register to comment.