'fnSetColumnVis' with 'multipleCheckOnly' selection mode

'fnSetColumnVis' with 'multipleCheckOnly' selection mode

TonyDTonyD Posts: 2Questions: 1Answers: 0

Hi,

I'm using fnSetColumnVis to show/hide multiple columns when a radio button is switched. My table also uses the sSelectionMode of 'multipleCheckOnly' which automatically creates a checkbox column to allow selection of rows within the table. This checkbox column has a column header on it that also has a checkbox, that selects all rows when checked.

My problem is that, when I show/hide any columns with fnSetColumnVis, the default checkbox column header disappears. Column [0] is my first column, not the checkbox column, so I'm not able to control it's visibility. The column itself doesn't disappear, just the header..

Is there any way to ensure this checkbox column header won't be hidden when hiding other columns?

Here is how my datatable is set up:

parentDataTable = config.selectors.$parentDataTable.dataTable({
            sDom: "<'$#table-header'>tr<'dataTables-footer'silp>",
            sSelectionMode: 'multipleCheckOnly',
            aoColumns: [
                 {
                     "sProperty": "TitleCode"
                 },
                {
                    "sProperty": "Issue"
                },
                {
                    "sProperty": "JobNumber"
                },
                {
                    "sProperty": "CycleId",
                    "bVisible": false
                },
                {
                    "sProperty": "TotalQuantity"
                },
                {
                    "sProperty": "StartShipDateAsString"
                },
                {
                    "sProperty": "InHomeRange"
                }
            ]
        });

And here is how I'm showing/hiding columns when the radio button is switched:

var showSelectedColumns = function (selectedValue) {
        if (selectedValue == "inhome") {
            parentDataTable.fnSetColumnVis(3, false, false);
            
            parentDataTable.fnSetColumnVis(0, true, false);
            parentDataTable.fnSetColumnVis(1, true, false);
            parentDataTable.fnSetColumnVis(2, true, false);
        }

        if (selectedValue == "cycle") {
            parentDataTable.fnSetColumnVis(0, false, false);
            parentDataTable.fnSetColumnVis(1, false, false);
            parentDataTable.fnSetColumnVis(2, false, false);

            parentDataTable.fnSetColumnVis(3, true, false);
        }
        parentDataTable.fnAdjustColumnSizing();
    };

Here is what the table looks like before showing/hiding any columns: http://i.imgur.com/6W6Ea9B.png

And here it is after showing and then hiding the columns. Notice the checkbox column header is missing: http://i.imgur.com/on7XGmx.png

Any help is appreciated!

Thanks!

This discussion has been closed.