Error when combining staterestore and keytable

Error when combining staterestore and keytable

jmullerjmuller Posts: 4Questions: 2Answers: 0

Link to test case: https://live.datatables.net/clone/7948/edit
Error messages shown: Uncaught TypeError: can't convert null to object
Description of problem: I would like to enable moving through rows using the arrow keys. However, when keys=true and I try to create a state in search builder, the error message above is shown in the browsers console which prevents loading of my website upon refresh. When keys=false, everything works as expected. The error also occurs with various older versions of datatables and plugins!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
    Answer ✓

    Hi,

    Thanks so much for the test case! The error is in how StateRestore checks if a saved state matches the current state. KeyTable can have a null value, which StateRestore isn't correctly handling.

    I've committed a fix which is now in the nightly build and with that the example works as expected.

    Allan

  • jmullerjmuller Posts: 4Questions: 2Answers: 0

    Brilliant, thanks a lot!!
    The nightly also seems to work with my slightly older setup:
    dt-1.13.6/b-2.4.1/date-1.5.1/fc-4.3.0/fh-3.4.0/kt-2.10.0/r-2.4.1/sc-2.2.0/sb-1.6.0/sp-1.4.0/sl-1.7.0

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin

    Yes, StateRestore still works with DataTables 1.x. It doesn't use any of the 2.x APIs yet.

    Allan

Sign In or Register to comment.