How to hide a column in KoGrid

811 views Asked by At

I have started working with koGrid. And I want to hide a special column 'id' in koGrid.How can i do that?

 gridOptions : {
        displaySelectionCheckbox: false,
        data: items,
        multiSelect: false, 
        enableColumnResize: true,                
        columnDefs: [
                      { field: 'id', displayName: 'id' },
                      { field: 'name', displayName: 'Name' }

        ]
    }
1

There are 1 answers

0
nemesv On BEST ANSWER

There is a visible option on the columnDefs what you can set to false:

columnDefs: [
    { field: 'id', displayName: 'id', visible: false },
    { field: 'name', displayName: 'Name' }
]

Or if you don't need the id value anywhere (so you're not using in template, or filtering sorting, etc.) you can just leave out the whole { field: 'id', displayName: 'id' }.