Toggle datagrid columns?

Is it possible to set datagrid columns to “hidden”, so the user can dyanmically select which ones he/she wants to see?

Hi Azuliani :waving_hand:

I won’t be able to answer this specific technical hurdle as it goes beyond my scope but I can guide you in the right direction.

Here’s a thread of some other peers that have been trying to achieve the same thing:

Drop a comment there and tag them to see how they figured it out.

last comment there is mine hahaha

The problem with this method is that it does not allow for “custom” column type, I think…

1 Like

Hi @azuliani

Have you tried using filters to hide the columns? Dynamic columns are just arrays, you can filter out the ones you want :slight_smile:

Yeah, but when we create a collumn manyally, we can choose the “custom” type to make a “custom cell”, with many elements other than text… I did not figure out how to make the array with that…

I tried putting making it like this:

[{“headerName”:“Column A”,“field”:“a”,“Type”:"Custom},
{“headerName”:“Column B”,“field”:“b”,“Type”:“Custom”}]

But I still cannot edit the content as if it was a custom type…

Ah not supported natively yet. We talked about it here: When I use the "Custom" option in the new data grid component, the space is not generated if I do this using a formula - #6 by santiago

You might be able to make this work by forking the component and updating the code. In which case, we are working on this.