Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep expanded/collapsed state of nodes when reloading a tree store #1864

Closed
fabiojpoli opened this issue Nov 12, 2020 · 2 comments
Closed

Keep expanded/collapsed state of nodes when reloading a tree store #1864

fabiojpoli opened this issue Nov 12, 2020 · 2 comments
Labels
feature request forum Issues from forum

Comments

@fabiojpoli
Copy link

Forum post

Allow refresh gantt data (project.load()) but keep all other components state (tasks expanded, zoom, etc).

Even using syncDataOnLoad : false the state like collapsed task is expanding again on demo bellow:

const project = new ProjectModel({
    transport : {
        load : {
            url : '../_datasets/launch-saas.json'
        }
    },
    taskStore : {
        syncDataOnLoad : false
    }
});

new Gantt({
    appendTo : 'container',

    project,

    columns : [
        { type : 'name', width : 250 }
    ],

    // Custom task content, display task name on child tasks
    taskRenderer({ taskRecord }) {
        if (taskRecord.isLeaf && !taskRecord.isMilestone) {
            return taskRecord.name;
        }
    }
});

project.load();

setInterval(function() {
    project.load();
}, 3000);
@fabiojpoli fabiojpoli added feature request forum Issues from forum labels Nov 12, 2020
@isglass
Copy link
Contributor

isglass commented Nov 13, 2020

syncDataOnLoad: false is the default, replacing the complete dataset. syncDataOnLoad: true would only update what has changed. Try that

@fabiojpoli
Copy link
Author

@isglass , changing on above example to true:

const project = new ProjectModel({
    transport : {
        load : {
            url : '../_datasets/launch-saas.json'
        }
    },
    taskStore : {
        syncDataOnLoad : true
    }
});

It returns an error:

Entity.js:70 Uncaught (in promise) Error: Already entered replica
at TaskModelEx.enterGraph (Entity.js:70)
at EngineReplica.addEntity (Replica.js:17)
at TaskModelEx.joinProject (ChronoPartOfProjectModelMixin.js:15)
at TaskModelEx.fn (SchedulerBasicProjectMixin.js:341)
at TaskModelEx.traverse (TreeNode.js:424)
at ProjectModel.traverse (TreeNode.js:430)
at ProjectModel.joinStoreRecords (SchedulerBasicProjectMixin.js:344)
at ProjectModel.repopulateReplica [as repopulateReplicaNow] (SchedulerBasicProjectMixin.js:264)
at ProjectModel. (Delayable.js:746)
at Function.invoker (Delayable.js:60)

@matsbryntse matsbryntse changed the title Keep state after reload project State should offer possibility to save expanded state of parent nodes in a tree store Nov 14, 2020
@isglass isglass changed the title State should offer possibility to save expanded state of parent nodes in a tree store Keep expanded/collapsed state of nodes when reloading a tree store Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request forum Issues from forum
Projects
None yet
Development

No branches or pull requests

3 participants