Hi Pankaj,
For your kind information, it is possible to restrict editing a specific node or a cell based on a condition by using the “BeginEdit” client side event. Please refer the below code snippet to cancel the editing with condition.
@(Html.EJ().Gantt("Gantt"). @(Html.EJ().Gantt("Gantt"). //... ClientSideEvents(eve => { eve.ActionComplete("ActionComplete"); eve.BeginEdit("BeginEdit"); }) ) <script type="text/javascript"> function BeginEdit(args) { var columns = this.getColumns(); if (args.data.status == 100) args.cancel = true; else if (args.data.status > 0 && columns[args.columnIndex].field == "startDate") args.cancel = true; } } </script> |
In the above code snippet we have restricted editing a cell with progress value equal to 100 and restricted editing a Start date cell of a task with progress value greater than 0 .
We have also prepared a sample based on this , please find the sample in the below location.
Sample: http://www.syncfusion.com/downloads/support/forum/119502/ze/RestrictEdit1331243618
Please let us know if you need further assistance on this.
Regards,
Mahalakshmi K.
Hi Pankaj,
Sorry for the inconvenience caused.
At present there is no support to disable the particular field in Gantt. And hence we have logged a feature report on “support to disable a particular field in Gantt”. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
And for your kind information, as for now we can give workaround for this requirement. Please follow the below code snippet to hide the particular field in edit popup.
@(Html.EJ().Gantt("Gantt"). //… .EditDialogFields(co => { co.Field("TaskId").Add(); co.Field("TaskName").Add(); co.Field("StartDate").Add(); co.Field("EndDate").Add(); co.Field("Duration").Add(); co.Field("Progress").Add(); }) .ClientSideEvents(eve => { eve.ActionComplete("ActionComplete"); eve.BeginEdit("BeginEdit"); }) //… ) <script type = "text/javascript" > function BeginEdit(args) { var ganttObject = $("#Gantt").data("ejGantt"); var columns = this.getColumns();
//To cancel the editing if status is equal to 100 if (args.data.status == 100) args.cancel = true;
//To cancel the start date editing if status > 0 else if ((args.data.status > 0 && args.columnIndex && columns[args.columnIndex].field == "startDate")) args.cancel = true;
//To remove the Start Date from edit popup else if (args.data.status > 0 && !args.columnIndex) { var editDialogFields = [ { field: "TaskId" }, { field: "TaskName" }, { field: "EndDate" }, { field: "Duration" }, { field: "Progress" }, ]; ganttObject.setModel({ "editDialogFields": editDialogFields }); }
} < /script> |
We have also prepared a sample based on this and you can find the sample under the following location.
Sample: http://www.syncfusion.com/downloads/support/forum/119502/ze/DialogCustomization-1109287077
Please let us know if you need further assistance on this.
Regards,
Mahalakshmi K.