Why doesn't visible: false work?

Why doesn't visible: false work?

philostowphilostow Posts: 4Questions: 2Answers: 0
    var dt_table = $('#radiological').DataTable({
        language: dt_language,  // global variable defined in html
        order: [[ 1, "desc" ]],  //order by column1 or mrn
        lengthMenu: [[10, 25, 50, 75, 100], [10, 25, 50, 75, 100]],
        columnDefs: [
//            {orderable: true,
//             searchable: true,
//             className: "center",
//             visible: false,
//             targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
//            },
//            {orderable: true,
//             searchable: true,
//             className: "never",
//             visible: false,
//             targets: [10, 11, 12]
//            },
            {
                data: 'id',
                targets: [0]
            },
            {
                data: 'mrn',
                targets: [1]
            },
            {
                data: 'acc_d',
                targets: [2]
            },
            {
                data: 'cat_d',
                targets: [3]
            },
            {
                data: 'desc_d',
                targets: [4]
            },
            {
                data: 'acc_r',
                targets: [5]
            },
            {
                data: 'cat_r',
                targets: [6]
            },
            {
                data: 'desc_r',
                targets: [7]
            },
            {
                data: 'td',
                targets: [8]
            },
            {
                data: 'is_annotated',
                targets: [9]
            }
            ,
            {
                data: 'discharge_summary',
                className: "never",
                visible: false,
                targets: [10]
            },
            {
                data: 'addendum',
                className: "never",
                visible: false,
                targets: [11]
            },
            {
                data: 'radiology_report',
                className: "never",
                visible: false,
                targets: [12]
            }
        ],
        searching: true,
        processing: true,
        serverSide: true,
        stateSave: true,
        ajax: TESTMODEL_LIST_JSON_URL
    });

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    Answer ✓

    My guess is you have stateSave: true, and you changed the settings but due to the state being saved it reverts back to the previous setting when reloading the Datatable. As a workaround you san use stateDuration and set it to w low value, like 1 second, reload the page and your display is probably correct now. Once its correct you can remove the setting.

    Kevin

  • philostowphilostow Posts: 4Questions: 2Answers: 0

    Thank you - that worked.

This discussion has been closed.