React Grid Column

1 Answer 545 Views
Grid
Kevin
Top achievements
Rank 1
Kevin asked on 16 Aug 2021, 10:51 AM

I'm sorry if this is already ask but i cant find similar topic.
I try to make show/hide column similar to this React (forked) - StackBlitz using checkboxes.
When i select all false, instead of all column dissapear, it will render all field of the Grid data object.
For example you can set show: false on every column in columns state in React (forked) - StackBlitz

First state when only 2 column shown

When all column show property set to false

Is it a bug or just the grid works?

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 16 Aug 2021, 11:21 AM

Hello, Kevin,

This is expected because when no columns are added the Grid will automatically generate the columns based on the data. This is intended to be a feature for automatic column generation. This is why in our demo for show/hide the columns we have a logic the disable the selection when only one column is left:

https://www.telerik.com/kendo-react-ui/components/grid/columns/column-menu/

Also, please have in mind that the Grid is a table element, and having a table with no columns is not semantically correct HTML. 

If you have a specific use case where this is required, please share more details with us and we will see if there is anything that we can offer.

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or