How to filter out hidden columns?

Dear All,

Could you advise if it’s possible to filter the DG.ColumnList? I need to obtain an object similar to what we get from grok.shell.t.columns but excluding hidden columns. This object should allow calling methods like .names() and toList() etc. on it.

Thanks in advance!

Best regards,
Nailia

1 Like

Hi Nailia,

Our JS API doesn’t provide the capability to get the filtered DG.ColumnList object, but you can filter it and get the column array. The example is provided in the code below.

const columns = grok.shell.t.columns;
const grid = grok.shell.tv.grid;
const visibleColNames = columns.names().filter((col) => grid.columns.byName(col).visible);
const visibleColumns = columns.byNames(visibleColNames);

Kind regards,
Dmytro

2 Likes

Hi Dmytro,

Got it. Thanks a lot!

Best regards,
Nailia

1 Like