Missing selector escaping in saveState reloading of child rows

Missing selector escaping in saveState reloading of child rows

jornekandziorajornekandziora Posts: 1Questions: 0Answers: 0

Link to test case: https://jsfiddle.net/bcoymras/
Debugger code (debug.datatables.net): n/a
Error messages shown: Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: escaping
Description of problem:
Datatables 1.11.0 introduced child rows to the saveState of datatables. It seems that some escaping is missing, which triggers an error when the table is empty after a reload. This issue can be reproduced with the following jsfiddle:

https://jsfiddle.net/bcoymras/

You can use the following steps to reproduce this issue. I have triggered it in both Firefox (96) and Chrome (98):

  • Open the jsfiddle page
  • Click on the "toggle content and reload" button to load a record in the table. This will add a record to the table, and add the identifier of this record to the childRows array of the save state.
  • (optional) Open the debug console, by pressing F12 in the browser, and make sure that the console tab is selected
  • Press F5 to reload the JSFiddle. This will reload the table, without any records in it.
  • Notice the following error: Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: escaping
  • The page will load properly, if we reload again (F5).

This situation can be mitigated by disabling the childRows data, on state load:

stateLoadParams: function(settings, data) {
  delete data.childRows;
}

see: https://datatables.net/reference/option/stateLoadParams

The id, however, should have been escaped properly, in the state reload handling.

Replies

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @jornekandziora ,

    Thanks for pointing this out. That should be the issue fixed now as you can see at this example. This will be available in the next DataTables release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.

    Thanks,
    Sandy

Sign In or Register to comment.