Hierarchy Grid caret icon toggle display

On a Hierarchy Grid is it possible to only display the caret icon if there is data in the sub-grid?



3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team August 31, 2020 10:08 AM UTC

Hi Michael, 

Greetings from Syncfusion support. 

We suggest you to add a class “HideDetailIcon” for the Grid row having empty sub-grid in the RowDataBound event of Grid. And now based on this added row class we can apply styles to hide the corresponding detail td element in Grid. We have prepared a sample based on this scenario, please download the sample from the link below, 
 
Please refer the codes below, 

<style>    .e-row.HideDetailIcon .e-detailrowcollapse {        pointer-events:none;    }    .e-row.HideDetailIcon .e-detailrowcollapse .e-dtdiagonalright{        display:none;    }</style>
 
<GridEvents RowDataBound="RowDataBound" TValue="EmployeeData"></GridEvents>
 
public void RowDataBound(RowDataBoundEventArgs<EmployeeData> args) 
{ 
    var i = Orders.Where(g=>g.EmployeeID.Equals(args.Data.EmployeeID)); 
 
    if (i.Count() == 0) 
    { 
        args.Row.AddClass(new string[] { "HideDetailIcon" }); 
    } 
} 



Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer

ML Michael Lambert September 2, 2020 09:10 PM UTC

Worked, Thanks!


RS Renjith Singh Rajendran Syncfusion Team September 3, 2020 05:15 AM UTC

Hi Michael, 

Thanks for your update. 

We are glad to hear that our suggestion helped you in achieving your requirement. 

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon