Articles in this section
Category / Section

How to allow the editing based upon the roles in Gantt control

1 min read

In Gantt, it is possible to restrict the editing based on the roles. This can be done by using the beginEdit and taskbarEditing events. The beginEdit event will be triggered while enter the edit mode in the TreeGrid cell and the taskbarEditing event will be triggered while dragging and resizing  the taskbar in Gantt chart. please refer the following code example for this.

//app.component.html
 
<ej-gantt id="GanttControl" [dataSource]="ganttData" taskIdMapping="taskID"
    taskNameMapping="taskName" startDateMapping="startDate"        
    (taskbarEditing)="taskbarEditing($event)" (beginEdit)="beginEdit($event)"
    //..
</ej-gantt>        

 

//app.component.ts
 
taskbarEditing(args) {
        var Resources = args.rowData.resourceInfo;
        for (var i = 0; i < Resources.length; i++) {
            if (Resources[i].resourceName != "Project Manager") {
                args.cancel = true;
                break;
            }
        }
    }
 beginEdit(args) {
        var Resources = args.data.resourceInfo;
        if (!ej.isNullOrUndefined(Resources))
        for (var i = 0; i < Resources.length; i++) {
            if (Resources[i].resourceName != "Project Manager") {
                args.cancel = true;
                break;
            }
        }
    }

A simple sample to restrict the editing based upon the roles in Gantt is available here.

Note:

In the above sample we have restricted both taskbar editing and cell editing when the role is not ‘Project Manager’.

 

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