Hi, it appears quite difficult to know how to retrieve the current gantt collection of records from the data source.
I don't find any way to do this. Could you help me?
Thank you
[ ASPX]
<ej:Gantt ID="Gantt" runat="server" AllowSelection="True"
//…
EnableWBS="true" EnableWBSPredecessor="true"
ActionComplete="ActionComplete"
</ej:Gantt>
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="True" />
function ActionComplete(args) {
var ganttRecord = args.data;
if (args.requestType === 'save' && args._cAddedRecord) {
//Newly Added Record is obtained here , which can be updated to database
if (args._cAddedRecord.parentItem)
ganttRecord["ParentId"] = args._cAddedRecord.parentItem.taskId;
PageMethods.AddIt(ganttRecord);
}
//To delete the selected row from the database
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 === 'outdent' || args.requestType === 'recordUpdate') {
var ganttRec = args.data.item;
PageMethods.UpdateIt(ganttRec);
}
}
//Delete inner level child records
function deleteChildRecords(record) {
var childRecords = record.childRecords,
length = childRecords.length,
count, currentRecord;
for (count = 0; count < length; count++) {
currentRecord = childRecords[count];
PageMethods.DeleteIt(currentRecord.item);
if (currentRecord.hasChildRecords) {
deleteChildRecords(currentRecord);
}
}
} |