columnControl - search with searchList and stateSave bug

columnControl - search with searchList and stateSave bug

spownspown Posts: 16Questions: 6Answers: 0

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

  1. open in broswer private window https://live.datatables.net/hudumofu/8
  2. press f5
  3. 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));
            },

Replies

  • allanallan Posts: 65,610Questions: 1Answers: 10,909 Site admin

    I've committed a fix for this error here - many thanks for brining it to my attention!

    Allan

Sign In or Register to comment.