stateLoadCallback is retrieving state data from server - but table state does not update

stateLoadCallback is retrieving state data from server - but table state does not update

tokenGeordietokenGeordie Posts: 3Questions: 1Answers: 0

I need to save table state data to the server, so I have implemented both a stateSaveCallback function and a stateLoadCallback function (as per the examples). This seems to be working as I can see a nice state json object being passed to and loaded from the server - but frustratingly my table state is not updating upon loading the state data. Am I missing something? Do I need to call draw() at some point?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Can you link to the page please? My guess is that you are loading using an Ajax request rather than Sjax (i.e. async rather than sync).

    Allan

  • tokenGeordietokenGeordie Posts: 3Questions: 1Answers: 0

    Thanks for responding, but it turned out to be my error. The way the backend was set up, I had to wrap the state object inside another object when saving to the server. Later, when datatables tried to load the saved state from the server it received an object structure different from what it was expecting, and therefore failed to parse. Working fine now thanks.

This discussion has been closed.