Some filters break bSaveState functionality
Some filters break bSaveState functionality
pidge
Posts: 1Questions: 0Answers: 0
Filters applied via fnFilter aren't escaped fully when the JSON for the cookie is created in _fnSaveState.
Some filters, particularly regex filters containing backslashes (ex: "^\s*CVM\s*$"), will result in the JSON being invalid. The backslashes in the example are not escaped, which is not allowed.
When _fnLoadState tries to load the resulting cookie, it fails, and the table state is not restored.
I fixed this locally by relying on the JSON library to do the escaping.
REPLACED:
[code]
for ( i=0 ; i
Some filters, particularly regex filters containing backslashes (ex: "^\s*CVM\s*$"), will result in the JSON being invalid. The backslashes in the example are not escaped, which is not allowed.
When _fnLoadState tries to load the resulting cookie, it fails, and the table state is not restored.
I fixed this locally by relying on the JSON library to do the escaping.
REPLACED:
[code]
for ( i=0 ; i
This discussion has been closed.
Replies
Thanks very much for catching this! I'm make sure it is fixed in the next release of DataTables. It won't use JSON.stringify unfortunately (since that would add another library dependency - I really with jQuery would include this ability...), but I'll try to make sure that this is properly escaped - good to see you've got a patch already!
Regards,
Allan