We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

args is undefined on ActionComplete

Thread ID:

Created:

Updated:

Platform:

Replies:

130113 Apr 22,2017 06:00 PM Apr 24,2017 08:23 AM ASP.NET Web Forms 2
loading
Tags: Gantt
Armand De Lange
Asked On April 22, 2017 06:00 PM

Hi

The args is undefined on all actions. 

Used this example:

https://www.syncfusion.com/kb/5562/how-to-update-changes-from-gantt-control-to-sql-database

 <ej:Gantt ID="GanttContainer" runat="server" CssClass="gantt" DataSourceID="SqlDataSource1"
        AllowSelection="true"
        ContextMenuOpen="contextMenuOpen"
        EnableContextMenu="true"
        TaskIdMapping="TaskId"
        TaskNameMapping="TaskName"
        StartDateMapping="StartDate"
        EndDateMapping = "EndDate"
        DurationMapping="Duration"
        ProgressMapping="Progress"
        IsResponsive="true"
        BaseLineStartDate ="baselineStartDate"
        BaseLineEndDate = "baselineEndDate"
        ScheduleStartDate="02/03/2017"
        ScheduleEndDate="03/09/2017"
        ParentTaskIdMapping="ParentId"
        TreeColumnIndex="1"
        AllowDragAndDrop="True"
        AllowGanttChartEditing="true"
        Load="load"
        Height="100%"
        EnableResize="true"
        AllowSorting="true"
        AllowMultiSorting="true"
        PredecessorMapping="Predecessors" ActionComplete="actioncomplete" TaskSchedulingMode="Auto">
        <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" AllowIndent="true" EditMode="cellEditing" />
        <SizeSettings Width="100%" Height="1000px" />
        
        <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,update,cancel,indent,outdent,collapseAll,expandAll,search" />
    </ej:Gantt>


    <script type = "text/javascript" >
        // To update the database through dialog editing or tool bar editing
        function actioncomplete(args) {
            var ganttRecord = args.data;
                alert(args.count);

            if (args.requestType === 'save' && args.addedRecord) {
                //Newly Added Record is obtained here , which can be updated to database

                if (args.addedRecord.parentItem)
                    ganttRecord["ParentId"] = args.addedRecord.parentItem.taskId;
                PageMethods.AddRecord(ganttRecord);

            } else if (args.requestType === 'delete') {
                var data = args.data;
                var ganttRec = data.item;
                PageMethods.DeleteRecord(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.UpdateRecord(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.DeleteRecord(currentRecord.item);
                if (currentRecord.hasChildRecords) {
                    deleteChildRecords(currentRecord);
                }
            }
        } 
</script>

THX
Armand

Armand De Lange
Replied On April 23, 2017 08:49 AM

On this linevar ganttRecord = args.data; ganttRecord is undefinedAnd updating it to this worked var ganttRecord = args._cAddedRecord.item;

Jayakumar Duraisamy [Syncfusion]
Replied On April 24, 2017 08:23 AM

Hi Armand, 
 
We regret for the inconvenience caused. 
 
We could reproduce the issue due to online documentation sample code mistake. This issue in KB will be corrected and refreshed ASAP. 
Please refer following code snippets, 
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 === 'outdent' || args.requestType === 'recordUpdate') {                 
                var ganttRec = args.data.item; 
                PageMethods.UpdateIt(ganttRec); 
            } 
 
        } 
 
We have also prepared a sample in ASP.NET to perform CRUD operation, please find a sample location below, 
Regards, 
Jayakumar D 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;