[Data Grid] How to manipulate column visibility?

Forge Component
(36)
Published on 17 Mar (2 weeks ago) by OutSystems R&D
36 votes
Published on 17 Mar (2 weeks ago) by OutSystems R&D

Hi,

I need to have ability to manipulate column and rows visibility based on the header value. I can change .visible attribute of specific column but that update is not reflected on the screen. I've trie greed refresh and refresh Cells functions but with no success. What is the correct way of manipulating column / rows or cells attributes and get them reflected on the screen grid?

Thank you.

After some research and fails working way of manually manipulate columns visibility is this:
GridOS.ComponentUtils.getGridObjectById('*****Grid element Id*****').grid.columns.map(function(col) {

//anything you want to do with column. for example toggle visibility by having text
if (col._binding._key.includes("serachText")){

   col.visible = !col.visible;

}

  })

Mykola (Nick) Tkachenko wrote:

After some research and fails working way of manually manipulate columns visibility is this:
GridOS.ComponentUtils.getGridObjectById('*****Grid element Id*****').grid.columns.map(function(col) {

//anything you want to do with column. for example toggle visibility by having text
if (col._binding._key.includes("serachText")){

   col.visible = !col.visible;

}

  })

Hi Mykola,

I would like to hide empty columns.

Where do you put this piece of code and where can I find the Grid Element id?