ColReorder 1.0.4 will nullify user-specified fnStateSaveCallback

ColReorder 1.0.4 will nullify user-specified fnStateSaveCallback

sisvesisve Posts: 1Questions: 0Answers: 0
edited September 2011 in Bug reports
Reproduced with DataTables 1.8.2 and ColReorder 1.0.4.

Assumption: The fnStateSaveCallback implementation follows the guidelines of the documentation (http://datatables.net/usage/callbacks#fnStateSaveCallback) and appends data to sValue.

The _fnSaveState function within DataTables builds the sValue string by appending several key/value combinations, one of them is aaSorting. It will then iterate over all specified fnStateSaveCallback functions, first the user specific which appends information, and then a call to the _fnStateSave method within ColReorder. The ColReorder function will only keep data before the aaSorting key, and append its own configuration after it. That means that any user-made changes done by appending to the string, which will be placed after the aaSorting key, will be lost.

I believe that the quickest/easiest workaround is to have the user-specified fnStateSaveCallback insert the json information into the beginning of the string.

Example: sValue = '{ "key": "value", ' + sValue.substr(1);
This discussion has been closed.