TreeGrid - ShowColumnChooser="true"

When you add in ShowColumnChooser="true" I want the user to be able to freeze or unfreeze columns, but it also adds into the menu "Columns" which I don't want to see show or have this functionality.


Also, I only want 3 columns to have the ability to freeze so I want to hide the menu chooser for all but the first 3 columns.

David

1 Reply

PE Punniyamoorthi Elangovan Syncfusion Team March 28, 2018 12:09 PM UTC

Hi David, 
Thank you for contacting Syncfusion support. 
Please find the below updates 
Query1: I want the user to be able to freeze or unfreeze columns, but it also adds into the menu "Columns" which I don't want to see show or have this functionality. 
Answer: We can include or exclude columns from column visibility list in column menu by using showInColumnChooser property. Please find the below code snippet. 
<ej:TreeGrid runat="server" ID="TreeGridContainer" ChildMapping="SubTasks" ShowColumnChooser="true" 
//.. 
   <Columns> 
            <ej:TreeGridColumn Field="xxxx0" HeaderText="Head1" ShowInColumnChooser="false" AllowFreezing="true" IsFrozen="true" ></ej:TreeGridColumn> 
            <ej:TreeGridColumn Field="xxxx1" HeaderText="Head2" ShowInColumnChooser="false" AllowFreezing="true" IsFrozen="true"></ej:TreeGridColumn> 
             <ej:TreeGridColumn Field="xxxx2" HeaderText="Head3" ShowInColumnChooser="false" AllowFreezing="true" IsFrozen="true"></ej:TreeGridColumn> 
             <ej:TreeGridColumn Field="xxxx6" HeaderText="Head" ShowInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn> 
             <ej:TreeGridColumn Field="xxxx7" HeaderText="Head" ShowInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn> 
             <ej:TreeGridColumn Field="xxxx8" HeaderText="Head" ShowInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn> 
       </Columns>    
</ej:TreeGrid> 
 
Query2: I only want 3 columns to have the ability to freeze so I want to hide the menu chooser for all but the first 3 columns. 
Answer: In treegrid we cannot hide the column chooser menu for specific columns. We can enable or disable the ability to freeze/unfreeze the columns by using allowFreezing column property. Please refer the below code snippet. 
<ej:TreeGrid runat="server" ID="TreeGridContainer" ChildMapping="SubTasks" ShowColumnChooser="true" 
//.. 
   <Columns> 
         <ej:TreeGridColumn Field="xxxx6" HeaderText="Head" showInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn> 
         <ej:TreeGridColumn Field="xxxx7" HeaderText="Head" showInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn> 
         <ej:TreeGridColumn Field="xxxx8" HeaderText="Head" showInColumnChooser="false" AllowFreezing="false"></ej:TreeGridColumn>                                             
       </Columns>    
</ej:TreeGrid> 
 
We have prepared the sample for your reference please find the sample below 
Regards, 
Punniyamoorthi 


Loader.
Up arrow icon