columnControl - search with searchList and stateSave bug
columnControl - search with searchList and stateSave bug
Link to test case: https://live.datatables.net/hudumofu/8
Debugger code (debug.datatables.net):
Error messages shown: Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Description of problem:
A combination of columnControl with search and searchList, where saveState is enabled, throws an error after page refresh
- open in broswer private window https://live.datatables.net/hudumofu/8
- press f5
- error Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
https://live.datatables.net/hudumofu/8/edit?js,output
new DataTable('#example', {
columnControl: ['order', ['search', 'searchList']],
ordering: {
indicators: false,
handler: false
},
stateSave: true
});
quick stupid fix > set null to undefined searchList in state
stateSaveCallback: function (settings, data) {
if (data.columnControl[0].searchList === undefined) {
data.columnControl = null;
}
localStorage.setItem(TABLE_STATE_KEY, JSON.stringify(data));
},