Our state of the art Gantt chart


Post by raju1 »

Hi,
I want to preserve Task Collapse/ Expand State when we reload the project again.
For Example: I have Tasks in which some tasks are collapsed/expand manually and when i reload the project
i want maintain the last state of collapse / expand task.
Please provide the working code or examples for this scenario.

Thanks


Post by mats »

Pretty easy to solve, you should save the 'expanded' boolean state in a database table of your own and link it with the current user id, then load the relevant user state when requested.


Post by raju1 »

Any working exampels or code please?


Post by alex.l »

Hi raju1,

Sure, you can try it yourself. Open any of Gantt examples and edit mock response data. As example, basic demo. Change expanded flag in a task record data from true to false, it will change the initial state. All you need is to save that state in your backend and apply when you need.

All the best,
Alex

All the best,
Alex


Post by alex.l »

Hi raju1,

Also it needs to be mentioned here that you will need to extend TaskModel to have that field in your data snippet that your server side gets from the front end. Something like this:

class MyTaskModel extends TaskModel {
    static get fields() {
        return [
            { name : 'expanded', persist: true }
        ];
    }
}

All the best,
Alex


Post Reply