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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Delete Child

Thread ID:

Created:

Updated:

Platform:

Replies:

131719 Jul 25,2017 07:27 AM UTC Jul 26,2017 07:30 AM UTC ASP.NET Web Forms 1
loading
Tags: Gantt
Martin Sickel
Asked On July 25, 2017 07:27 AM UTC

I am using your example for addinging deleteing and updating the chages made on the gantt.

    <script type="text/javascript">

        function ActionComplete(args) {            

            var myGantt = args.data;


            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);

            }


        }


        //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>


which is working fine with maintasks, if I try to delete a child, the PageMethode for delete will not call the codebehind webmethod, How can this be done?

Martin

Jayakumar Duraisamy [Syncfusion]
Replied On July 26, 2017 07:30 AM UTC

Hi Martin, 
We have analyzed your given code snippet and found that both server side method names are different. Can you please ensure that “DeleteRecord” method is valid method name? otherwise, rename the DeleteRecord as “DeleteIt”. 
Please refer following code snippet, 
 else if (args.requestType === 'delete') { 
                var data = args.data; 
                var ganttRec = data.item; 
                PageMethods.DeleteIt(ganttRec); 
                if (data.hasChildRecords) { 
                    deleteChildRecords(data); 
                } 
            } 
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);   // Rename it as DeleteIt 
                if (currentRecord.hasChildRecords) { 
                    deleteChildRecords(currentRecord); 
                } 
            } 
        } 
 
Please let us know, if you require any other assistance. 
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.

Warning Icon 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.Close Icon

;