In datatable how to get the value of column header of the cell.
I am using the following code snippet to get column and row ID’s
var columnId = grid.getSelectedId().column; // output value : data6
var rowId = grid.getSelectedId().row; // output value : 1390307879906
grid.getItem(rowId);
grid.getItem(columnId); // not working
How to get the values corresponding to the columns ?
Do I have to iterate whole header. I have very large number of header columns around 3000 and I need header corresponding to selected cell.
so when on selected cell I call grid.getSelectedId().column; I get the id of header in my case it is ‘data6’. So now how to get the text value of the header from the id.
var label = grid.getColumnConfig(columnId).header[0].text;
If you have a multiline(or single line) header
var header = grid.getColumnConfig(columnId).header;
var label = header[header.length - 1].text;
In both cases you need not iterate through all columns. There is method which return column configuration by column id ( grid.getSelectedId().column ) and from column configuration you can read the text of header.