Our state of the art Gantt chart


Post by leanit »

Hello,
While testing the Gantt, we noticed that when sorting tasks by any field, the application not only reorders the tasks for display purposes, but also changes their internal order. For instance, if we sort by the "name" field and then save, the data sent to the backend (via project.toJSON().tasksData) is ordered just like in the grid.

Is this behavior intentional? We would have expected the sorting to be purely visual and not to affect the actual order of tasks.

This behavior can also be reproduced in your examples:
simply sort by any field and then print project.toJSON().tasksData.

Thank you, Luca.


Post by Maxim Gorkovsky »

Hello.
You can override parentIndex field to make it non-persistable:

class MyTaskModel extends TaskModel {
  static fields = [{ name: 'parentIndex', persist: false }]
}

Post by leanit »

Hi Maxim,
Unfortunately, the solution you proposed didn’t work for our case. On the backend side, we were reordering the tasks specifically based on the parentIndex, so not persisting it anymore caused issues.

In the end, we resolved it by reordering tasks based on the orderedParentIndex field. Reordering the tasks based on that and setting

            taskStore: {
                wbsMode: {
                    sort: false
                }
            }

as a configuration for the ProjectModel, seems to have given us the result we wanted.

Thank you, Luca.


Post Reply