Save a complete copy of the gantt data in firestore after any changes

Hi! Is there an easy way to save all Gantt changes (whenever they happen) to an external database like Firestore or json format? I have already implemented CRUD and successfully update my Firestore DB. But there are many other types of changes like indent, outdent, rowchanges, etc, with I haven't done, as each of them needs a new/different implementation.

Another thing is that when working with an external database, the date format changeds, so it is a little bit difficult to restore the Syncfusion format date when we have, for example, a tree of 3 o 4 subtasks.

Last but not least, if I insert a new task between other task, all the indexes have to be changed in my database so that later when I come back, I can restore the same data/order.


1 Reply

PS Premkumar Sudalaimuthu Syncfusion Team April 7, 2022 01:59 PM UTC

Hi Felipe,


Query

Solution

Hi! Is there an easy way to save all Gantt changes (whenever they happen) to an external database like Firestore or json format? I have already implemented CRUD and successfully update my Firestore DB. But there are many other types of changes like indent, outdent, rowchanges, etc, with I haven't done, as each of them needs a new/different implementation.

In two ways we can able to save the values in database.

 

  1. Batchurl all the operations such as row drag and drop, indent outdent can be automatically updated in the database.
  2. You can also update individual actions with their request type in actionComplete event to update its values in database.

 

Online Documentation:

Another thing is that when working with an external database, the date format changeds, so it is a little bit difficult to restore the Syncfusion format date when we have, for example, a tree of 3 o 4 subtasks.

Since we are declaring the type of start date and end date as Datetimeobject (public DateTime? startDate { get; set; }) in data source their values are passed as same format in sever. If you want to pass the date as same as the format given in dateFormat property then you need to define the date values as string or need to change the format as you needed in sever.

Last but not least, if I insert a new task between other task, all the indexes have to be changed in my database so that later when I come back, I can restore the same data/order.

We have prepared a example including a custom column that will reset the numbers or sequencing the numbers after save.  We can achieve this by reset the order of custom column in actionComplete event. We have shared code snippets for your reference.

 

Code snippets:

 

 

actionComplete(args: any) {

    var data = this.ganttObj.currentViewData;

    var id = 1;

    for (var i = 0; i < data.length; i++) {

      data[i].Custom = id;

 

      id++;

    }

  }

 

 

 

Sample: https://stackblitz.com/edit/angular-67u55v?file=app.component.ts




Regards,

Premkumar S


Loader.
Up arrow icon