columnDefs.visible not working when stateSave=true

columnDefs.visible not working when stateSave=true

badassccbadasscc Posts: 2Questions: 1Answers: 0
edited November 2019 in Free community support

Hi,

The datatables was working fine until i switch to using $.fn.dataTable.defaults , after some digging found that columnDefs.visible is not working when stateSave=true. Any thoughts?

$.extend(true, $.fn.dataTable.defaults, {
    paging: dfPaging,
    lengthChange: dfLengthChange,
    searching: dfSearching,
    scrollX: dfScrollX,
    scrollY: dfScrollY,
    scrollCollapse: dfScrollCollapse,
    stateSave: dfStateSave,
    select: dtSelectOptions
});

var dtTableContactGroupsContent = {
    data: input,
    columns: [
        { data: null, defaultContent: '' },
        { data: 'Id', 'visible': false },
        { data: 'Name' },
        { data: 'Description' }
    ],
    columnDefs: [
        {
            targets: 0,
            orderable: false,
            className: 'select-checkbox'
        }, {
            "targets": [1],
            "visible": false,
            "searchable": false
        }
    ],
    order: [[2, 'asc']]
};

Answers

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    Hi @badasscc ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • badassccbadasscc Posts: 2Questions: 1Answers: 0
  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    Can you give instructions on how to reproduce the issue, please. I ran it, and that second column, Position, wasn't visible as expected.

This discussion has been closed.