Articles in this section
Category / Section

How to format the cell values in TreeGrid?

1 min read

In Tree Grid we can customize column with different data formats like Currency, Date, Numeric and Percentage by using “format” property of “columns”. The below code example explains about how to format the columns in Tree Grid.

<div id="TreeGridContainer" style="height:400px;width:100%"></div>    
<script type="text/javascript">
$(function () {
    $("#TreeGridContainer").ejTreeGrid({
        //                
        columns: [
{ field: "Number", format: "{0:n2}", editParams: { decimalPlaces: 3, incrementStep: 0.01 }, editType: ej.TreeGrid.EditingType.Numeric, },
{ field: "Currency", format: "{0:c2}", editParams: { decimalPlaces: 2, incrementStep: 0.01 }, editType: ej.TreeGrid.EditingType.Numeric },
{ field: "Percentage", format: "{0:P0}", editParams: { decimalPlaces: 2, incrementStep: 0.1 }, editType: ej.TreeGrid.EditingType.Numeric },
                ],
      })
});      
</script>
 

 

Screen shot:

A screenshot of a cell phone

 

Sample link:

A Sample to format the cell values of Tree Grid columns is available in the below link

Sample

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied