3

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' }

        ]
    }
Midhuna
  • 4,523
  • 4
  • 21
  • 22

1 Answers1

5

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' }.

nemesv
  • 138,284
  • 16
  • 416
  • 359