We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the TreeGrid column using angular template ?

Platform: ASP.NET MVC |
Control: TreeGrid |
Published Date: August 16, 2018 |
Last Revised Date: May 29, 2019

In tree grid, the column can be customized with angular template by defining the isTemplateColumn and angularTemplate properties in column array collection.

  • isTemplateColumn is a Boolean property used to denote a template column.
  • angularTemplate is a property used to map the template ID to the column.

The below code snippet explains how to customize the tree grid column using angular template.

CSHTML

<div ng-app="listCtrl">
<div ng-controller="TreeGridCtrl">
<div style="height:370px;width:100%;" ej-treegrid e-datasource="data" e-editSettings="editSettings" e-columns="columns" e-childmapping="Children">
</div>
</div>    
</div>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/ej/ej.widget.angular.min.js"></script>
 
<script type="text/ng-template" id="ngColumnTemplate">
<img src="../../Images/treegrid/{{data.FullName}}.png" /> 
</script>
<script>
var columns = [
{ field: "Address", headerText: "Employee Details", isTemplateColumn: true, angularTemplate: "#ngColumnTemplate" },
//…
];
var treeData = [{
"Name": "Robert King",
"FullName": "Robert King",
"Designation": "Chief Executive Officer",
"EmployeeID": "EMP001",
"Address": "507 - 20th Ave. E.Apt. 2A, Seattle",
"Contact": "(206) 555-9857",
"Country": "USA",
"DOB": "2/15/1963",
"Children": [{
"Name": "David william",
"FullName": "David william",
//…
}]
}];
angular.module('listCtrl', ['ejangular'])
.controller('TreeGridCtrl', function ($scope) {
$scope.columns = columns;
//…
});
</script>

Sample for rendering a tree grid column with angular template is available here.

 

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile