Appearance and Styling

8 Feb 20184 minutes to read

The look and feel of the TreeGrid control can be customized by applying themes.

The following are the available themes in TreeGrid control.

  1. Flat Azure                
  2. Flat Azure Dark             
  3. Flat Lime                             
  4. Flat Lime Dark                  
  5. Flat Saffron                       
  6. Flat Saffron Dark
  7. Gradient Azure
  8. Gradient Azure Dark
  9. Gradient Lime
  10. Gradient Lime Dark
  11. Gradient Saffron
  12. Gradient Saffron Dark
  13. Bootstrap

You can apply the theme (Gradient lime) to the TreeGrid control by using the style sheet from the online link as follows.

  • HTML
  • <!DOCTYPE html>
    <html xmlns="">
    	<title>Getting Started with TreeGrid Control for JavaScript</title>
    	<!-- style sheet for default theme(gradient lime) -->
    	<link href="" rel="stylesheet">

    The following screenshot shows the TreeGrid control with Gradient-lime theme.

    Configuring CSS class

    In TreeGrid cssClass property is used to apply different custom styles to multiple TreeGrid controls available in the webpage.

    The following code example shows how to apply different background color for each TreeGrid control’s toolbar element.

  • HTML
  • <style>
            .c-class1.e-treegrid .e-toolbar {
                background-color: rgba(169, 45, 45, 0.31);
            .c-class2.e-treegrid .e-toolbar {
                background-color: rgba(0, 128, 0, 0.2);
            <div id="TreeGridContainer"></div>
            <div id="TreeGridContainer1"></div>
            cssClass: "c-class1",
            cssClass: "c-class2",

    The below screenshot shows the output of above code example.

    Customize rows and cells

    In TreeGrid, while rendering rows rowDataBound event will be triggered for rows. Similarly queryCellInfo event will be triggered for every cells. Using these events we can customize the tree grid rows and cells at initial load.

    The below code example shows how to customize the rows and cells in tree grid.

  • JS
  • $("#treegrid").ejTreeGrid({
                queryCellInfo: function (args) {
                    if (args.column.mappingName == "progress") {
                        if (["progress"] < 75)
                            $(args.cellElement).css("background-color", "rgba(255, 0, 0, 0.12)");
                            $(args.cellElement).css("background-color", "rgba(86, 226, 86, 0.25)");
                rowDataBound: function (args) {
                    if (["taskID"] == 5)
                        $(args.rowElement).css("background-color", "rgba(251, 255, 0, 0.24)");

    The below screenshot shows the output of above code example.