Omit / hide column from filter in KoGrid?

31 Views Asked by At

Does anyone know if it is possible to omit / hide a column from the filter (list of checkboxes) on KoGrid? If so, how? (I'm hoping there's something that can be done to achieve this in the ColumnDefs property)

1

There are 1 best solutions below

0
On

(Answering own question, in case it helps others). What I ended up doing, is subscribing to the Grid's showMenu() observable, and hiding elements that pertained to columns with labels that were empty string or only whitespace.

             self.Grid().showMenu.subscribe(function (val) {
                if (val != true) return;
                var colDefId = 0;
                self.gridOptions.columnDefs.forEach(function (colDef) {
                    if (!colDef) return;
                    if (!/\S/.test(colDef.displayName)) $($('.kgColListItem')[colDefId]).hide();
                    colDefId++;
                });
            });