Heading backcolour

Hi,

How can you control the backcolour of the headings

e.g.

          background#f2f2f2;


Also, how can you make a row backcolour 

          background#f2f2f2;

David

1 Reply

PE Punniyamoorthi Elangovan Syncfusion Team March 23, 2018 12:38 PM UTC

Hi David, 
Thank you for contacting Syncfusion support. 
Please find the below updates 
Query1: How can you control the backcolour of the headings 
Answer: We can set the background color to the treegrid header by using the cssClass property. We can apply different custom styles to multiple TreeGrid controls available in the webpage by this property. Please find more details about this property here and also please refer the below code snippet. 
<style> 
        .c-class1.e-treegrid .e-gridheader { 
            background-color: rgba(169, 45, 45, 0.31) !important; 
        } 
</style> 
 
 
<ej:TreeGrid runat="server" CssClass="c-class1" ID="TreeGrid" ChildMapping="SubTasks" 
//.. 
 
</ej:TreeGrid> 
 
Query2:  how can you make a row backcolour  
Answer: We can achieve this by using rowDataBound client side event. Please find the code snippet below 
<style> 
        .customcolor1 {         
        background-color: #f2f2f2 !important 
         } 
        .customcolor2 {         
        background-color: green !important; 
         } 
</style> 
 
<ej:TreeGrid runat="server" Height="10px" ID="TreeGrid" ChildMapping="SubTasks" RowDataBound="rowDataBound" TreeColumnIndex="4"> 
//.. 
 
</ej:TreeGrid> 
 
<script> 
        function rowDataBound(args) { 
            if (args.data.ID == 1) 
                $(args.rowElement).addClass("customcolor1") 
            else if (args.data.ID == 2) 
                $(args.rowElement).addClass("customcolor2") 
        } 
    </script> 
 
We have prepared the sample with your requirements please find the sample below 
 
Regards, 
Punniyamoorthi 


Loader.
Up arrow icon