Column Template in ResourceView Mode based in resource property

Hi,

I want to create a column in a gantt in resource view mode ant fill it using a template. 
The template is just an icon that depends on a resource property called 'state'. How can I access to this property in the template?

Thanks.

1 Reply

PE Punniyamoorthi Elangovan Syncfusion Team July 5, 2018 01:50 PM UTC

Hi Oscar, 
Thank you for contacting Syncfusion support 
We have analyzed your requirement. In Resourceview Gantt we can add custom column in grid part by using load client side event, and also we can customize the column by using columnTemplate support. Please refer the below code snippet 
[HTML] 
<ej-gantt id="resourceGantt" 
          [dataSource]="resourceGanttData" 
          [viewType]=viewType 
          (load)="load($event)" 
           //.. 
            > 
</ej-gantt> 
 
[TS] 
load(args) { 
        var ganttObject= $("#resourceGantt").ejGantt("instance"); 
        var customColumn = { 
            field: "status", 
            mappingName: "status", 
            allowEditing: false, 
            headerText: "Status", 
            isTemplateColumn: true, 
            templateID: "columnTemplate", 
             
        }; 
        var ganttcolumns = ganttObject.getColumns(); 
        ganttcolumns.push(customColumn); 
    } 
[HTML] 
<body> 
    <script id="columnTemplate" type="text/x-jsrender"> 
        {{if status=="Active"}} 
        <div class="image"></div> 
        {{else status=="InActive"}} 
        <div class="image1"></div> 
        {{/if}} 
    </script> 
</body> 
We have prepared the sample, in this sample we have rendered the icons in custom column(Status) based upon the resource data source field of ”status”. 
Please find the sample link below 
Please let us know if you require further assistance on this. 
Regards, 
Punniyamoorthi 



Loader.
Up arrow icon