简体   繁体   中英

Omit / hide column from filter in KoGrid?

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)

(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++;
                });
            });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM