<ej:Gantt ID="container" runat="server"
//…
ActionComplete="ActionComplete"> </ej:Gantt>
<asp:ScriptManager runat="server" EnablePageMethods="true"></asp:ScriptManager>
<script type="text/javascript">
function ActionComplete(args) {
if (args.requestType === 'save' && args.addedRecord) {
//Newly Added Record is obtained here , which can be updated to database
var ganttRecord = args.addedRecord;
if (args.addedRecord.parentItem)
ganttRecord["ParentId"] = ganttRecord.parentItem.taskId;
PageMethods.AddIt(ganttRecord.item);
} else if (args.requestType === 'delete') {
var data = args.data;
var ganttRec = data.item;
PageMethods.DeleteIt(ganttRec);
if (data.hasChildRecords) {
deleteChildRecords(data);
}
}
// To update the database during Outdent,editing,indent,predecessor update operation
else if (args.requestType === 'recordUpdate') {
var ganttRec = args.data.item;
PageMethods.UpdateIt(ganttRec);
}
} |