Hide or disable checked boxes Treegrid

Hi 

I want hide or disable root node from treegrid, also checkbox in header...
I am using Blazor 18.4.0.43, Wasm project

Can you help me?



Attachment: Screenshot_12_7157ac17.rar

1 Reply 1 reply marked as answer

PS Pon Selva Jeganathan Syncfusion Team March 15, 2021 10:59 AM UTC

Hi Jose,   
 
Thanks for using syncfusion products. 
 
Query: Hide or disable checked boxes Tree grid 

We suggest you to achieve your requirement  by using QueryCellInfo event of Grid and AddClass() method to disabled the checkbox using CSS styles. Refer the below code example.   

<SfTreeGrid DataSource="@TreeGridData" IdMapping="TaskId" AllowSelection="true" ParentIdMapping="ParentId" TreeColumnIndex="1"> 
    <TreeGridEvents QueryCellInfo="QueryCellInfo" TValue="TreeData"></TreeGridEvents> 
    .. 
</SfTreeGrid> 
<style> 
    .e-checkbox-disabled {      // disable root element checkbox 
        background-color: #ddd; 
        pointer-events: none; 
    } 
 
    .e-grid.e-responsive .e-headercelldiv.e-headerchkcelldiv {  //disable headercheckbox 
        background-color: #ddd; 
        pointer-events: none; 
    } 
</style> 
 
@code{ 
     
 
    protected void QueryCellInfo(QueryCellInfoEventArgs<TreeData> args) 
    { 
 
        if (args.Column.Type == ColumnType.CheckBox && args.Data.ParentId == null) 
        { 
            args.Cell.AddClass(new string[] { "e-checkbox-disabled" }); 
        } 
    } 
}       
  

Please refer to the below sample,

https://www.syncfusion.com/downloads/support/forum/163475/ze/SyncfusionBlazorApp31019327760

Please refer to the below documentation:

https://blazor.syncfusion.com/documentation/treegrid/events/#querycellinfo

Please refer to the below API documentation:

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_QueryCellInfo

Kindly get back to us for further assistance.

 
Regards,  
Pon selva   


Marked as answer
Loader.
Up arrow icon