Back button using Deeplink search

Back button using Deeplink search

WizardOfYendorWizardOfYendor Posts: 1Questions: 1Answers: 0

This has been driving me crazy as I have tried many, many things regarding saving state, loading state parameters etc... nothing I do seems to work correctly.

The problem is straight forward. Given the deeplink example here: https://datatables.net/blog/2017-07-24, if on the 1st page you search for "san francisco" then go to page 2 of the data. Then go click the link at the top of "set a search term ("software") - the link takes you to a new page in the current window an searches fine.

If you then click the back button, you return the the previous screen but while the search box is populated with your search term "san francisco", it's not applied. If you click in the search box etc... (keyup event), it will search but then you'll be on page one.

Is there a way when the user clicks the back button after clicking a deeplink URL, like, https://datatables.net/blog/2017-07-24?search.search=software, that they can return to where they left of on the previous page/table? i.e. the search term is applied and they are on the same data "page" they left from (e.g. page 2) ?

Thanks.

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    The back button just takes you to the previous URL, it doesn't consider the state of the code on the page, so it just returns to that default view. You could try enabling stateSave - that 'remembers' the state of the table (the pagination, ordering and filtering), so may do what you're after.

    Colin

Sign In or Register to comment.