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.
Syncfusion Feedback

How to read all Gantt data?

Thread ID:

Created:

Updated:

Platform:

Replies:

118283 Feb 19,2015 11:56 AM UTC Mar 14,2018 08:51 AM UTC JavaScript 2
loading
Tags: ejGantt
Franjkovic Ivan
Asked On February 19, 2015 11:56 AM UTC

Hello
I want to save all data from Gantt so I need somehow read all records. How can I do that?
Thank you.

Franjkovic Ivan
Replied On February 19, 2015 01:50 PM UTC

Additional to read all Data, I need to "catch" create and delete  event.
I found how to track changes
http://www.syncfusion.com/forums/118066/update-gantt-values-and-save-to-database
but delete and create of event does not work for me.
Do you have some example of events for create and delete of Gantt chart items, please?
Thank you.

John Rajaram [Syncfusion]
Replied On February 20, 2015 01:41 PM UTC

Hi Franjkovic,

Thanks for using Syncfusion products.

We would like to let you know that, in Gantt control, we can read or save the data to the SQL database while adding, deleting and updating the record. But it can be achieved only through ASP.NET or ASP.NET MVC platform with the help of following client side events.

1.     ActionComplete

2.     TaskbarEdited and

3.     EndEdit

Please refer the following code snippets for retrieving the data while adding, deleting and updating the record in JS platform.

Code snippets:

<script type="text/javascript">

       

        $(function () {

            $("#gantt").ejGantt({

             //...

            taskbarEdited: taskbarEdited,

            endEdit: endEdit,

            actionComplete: actionComplete,

            });

        });

       

       

        // To update the database while cell editing

        function endEdit(args) {

            var obj = $("#gantt").data("ejGantt");

            if (args.data && args.type === 'endEdit' && args.previousValue)

                var ganttRec = args.data.item; //Edited Record is obtained here , which can be updated to database

            //To retrieve datasource after updating a record

            var currentDatasource = obj.model.dataSource;

        }

        // To update the database while editing the taskbar item

        function taskbarEdited(args) {

            var obj = $("#gantt").data("ejGantt");

            if (args.data && args.type === 'taskbarEdited' && args.previousData)

                var ganttRec = args.data.item;  //Edited Record is obtained here , which can be updated to database                          

            //To retrieve datasource after updating a record

            var currentDatasource = obj.model.dataSource;

        }

        // To update the database through dialog editing or tool bar editing

        function actionComplete(args) {

             var ganttRecord = args.data, obj = $("#gantt").data("ejGantt");

          

             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;

              

                 var newRecord = ganttRecord; // This variable holds the data of the new record which is to be added in database

                 //To retrieve datasource after adding a record

                 var currentDatasource = obj.model.dataSource;

             }

             else if (args.requestType === 'save') {

                 //Edited Record is obtained here , which can be updated to database

                 if (args._cModifiedData.parentItem)

                     ganttRecord["ParentId"] = args._cModifiedData.parentItem.taskId;

                 ganttRecord["Predecessor"] = args._cModifiedData.item.Predecessor;

                 var updatedRecord = ganttRecord; // data to be updated in database

                 //To retrieve datasource after updating a record

                 var currentDatasource = obj.model.dataSource;

             }

             else if (args.requestType === 'delete') {

                 var data =args.data;

                 var ganttRec = data.item; // It is the data which is to be deleted in database       

                 //To retrieve datasource after deleting a record

                 var currentDatasource = obj.model.dataSource;

             }

                 // To update the database during Indent operation

             else if (args.requestType === 'endedit') {

                 var ganttRec = args.data.item;

                 var updatedRecord = ganttRec; // data to be updated in database

                 //To retrieve datasource after updating a record

                 var currentDatasource = obj.model.dataSource;

               

             }

                 // To update the database during Outdent operation

             else if (args.requestType === 'actionComplete') {

                 var ganttRec = args.data.item;

                 if (args.data.parentItem)

                     ganttRec["ParentId"] = args.data.parentItem.taskId;

                 var updatedRecord = ganttRec; // data to be updated in database

                 //To retrieve datasource after updating a record

                 var currentDatasource = obj.model.dataSource;

              

             }

          

         } 

    </script>

Please find the following online KB links for updating SQL database.

1.     ASP.NET platform

Link: https://www.syncfusion.com/kb/3086/how-to-add-delete-and-update-the-sql-database-through-gantt

2.     ASP.NET MVC platform

Link: https://www.syncfusion.com/kb/3085/how-to-add-delete-and-update-the-sql-database-through-gantt

We have also prepared a sample in JS platform. Please find the sample in the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/Vol4_SP1_sample-1473417007.zip

Please let us know if you need more information on this.

Regards,
John. R



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

;