Articles in this section
Category / Section

How to disable editing for a specific cell in JavaScript Gantt?

1 min read

JavaScript Gantt allows you to edit a cell, when you double click on the cell, and when editSettings.allowEditing’ property is set to true and ‘editSettings.editMode’ property is set to ‘cellEditing’.

In order to disable editing for a particular cell, you have to cancel the ‘beginEdit’ event for that cell. Since this event will be triggered whenever a cell is about to enter edit mode, cancelling this event by setting ‘args.cancel’ to ‘true’ in the event handler will prevent the cell from entering into edit mode.

In the following code example, editing on the cell with progress status as 100% have been cancelled as well as editing on all the cells in ‘startDate’ column have also been cancelled.

<body>
<div id="gantt"></div>
<script type="text/javascript">
var projectData = [{
taskID: 1,
taskName: "Project Schedule",
startDate: "02/03/2014",
endDate: "03/07/2014",
subtasks: [
//...
]
}, ];
$(function () {
$("#gantt").ejGantt({
//…
beginEdit: beginEdit
});
function beginEdit(args) {
debugger;
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;
}
});
</script>
</body>
 

A simple sample to disable editing for a specific cell in Gantt is available in the following link.

Sample


Conclusion

I hope you enjoyed learning about how disable editing for a specific cell in JavaScript Gantt.

You can refer to our JavaScript Gantt feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Gantt example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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