How to remove collapse and expand button column in kendo react grid UI

1 Answer 231 Views
Accessibility Grid Styling / Themes
Nitin
Top achievements
Rank 1
Nitin asked on 11 Aug 2023, 05:46 AM | edited on 11 Aug 2023, 05:50 AM
As I shown in the attached jpg file, I want to remove the first column which is showing the expand button (+) using Kendo React. As I'm a new to kendo react I have tried by setting this column width to zero but the css is not applying it. Then I have tried to apply width using the query selector but that was also not worked. I also tried by applying "display: none" to .k-hierarchy-cell, its working and hiding that first column but it is shrinking the next column to its size. Please guide me on this for expanded rows. 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 14 Aug 2023, 07:39 AM

Hi Nitin,

In order to hide the column you can just remove the onExpandChange event handler and there should be no auto-generated expand/collapse column. In the following example you can see how a custom column is used for expanding/collapsing and the default one is not visible (due to the removed onExpandChange):

As for removing the expand column with CSS, here is an example demonstrating this approach:

            <style>
            .k-grid th:nth-child(1),
            .k-grid col:nth-child(1),
            .k-grid td:nth-child(1){
                display: none;
            } 

You can add custom class name to the Grid and include it in the CSS selectors, so it can be applied to that particular Grid only. 

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Nitin
Top achievements
Rank 1
commented on 27 Aug 2023, 05:30 AM

thanks @Konstantin Dikov it's working. 
Tags
Accessibility Grid Styling / Themes
Asked by
Nitin
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or