Our state of the art Gantt chart


Post by SIM-LTD »

Hi

We have been struggling with the dependencyStore and did not succeed to set the dependencies.
Could you tell us what's is wrong or is there any issue, because when the code (see below = gantt.dependencyStore.data ) is in place then we are facing an issue (look at the screenshot)

// Add TaskEvent
gantt.taskStore.data = { 
    id : 1,
    name : 'Write docs',
    startDate : '2017-01-02', 
    endDate : '2017-01-10',
    expanded : true,
    children : [
      { id : 2, name : 'Proof-read docs', startDate : '2017-01-02', endDate : '2017-01-06' },
      { id : 3, name : 'Release docs', startDate : '2017-01-06', endDate : '2017-01-10' }
    ]
};
                                            
// Add Dependencies
gantt.dependencyStore.data = {  fromEvent : 2, toEvent : 3 };


After a little while, we succeed to add dependencies like this :
// Add TaskEvent
gantt.taskStore.data = { 
    id : 1,
    name : 'Write docs',
    startDate : '2017-01-02', 
    endDate : '2017-01-10',
    expanded : true,
    children : [
      { id : 2, name : 'Proof-read docs', startDate : '2017-01-02', endDate : '2017-01-06' },
      { id : 3, name : 'Release docs', startDate : '2017-01-06', endDate : '2017-01-10' }
    ]
};
                                            
// Add Dependencies
gantt.dependencyStore.add({  fromEvent : 2, toEvent : 3 });

As a matter of fact it seems that using "data" as property does not work.
But using "add" function gives us what expected, to wit : adding dependencies.

Could you tell us what's wrong with "gantt.dependencyStore.data = { fromEvent : 2, toEvent : 3 };"
whilst using the function is ok "gantt.dependencyStore.add({ fromEvent : 2, toEvent : 3 });"

Thank you
Attachments
Capture d’écran 2019-05-17 à 20.27.08.png
Capture d’écran 2019-05-17 à 20.27.08.png (343.79 KiB) Viewed 1317 times

Post by mats »

Adding dependencies is not done by replacing the entire array.

This would work if you set it in an array, not just an object. WRONG:
gantt.dependencyStore.data = {  fromEvent : 2, toEvent : 3 };
CORRECT:
gantt.dependencyStore.data = [{  fromEvent : 2, toEvent : 3 }];
But what you should do is:
dependencyStore.add({ ... });
Docs: https://bryntum.com/docs/grid/#Common/d ... nction-add

Post by SIM-LTD »

We, naively, used this approach with the TaskEvent Store "gantt.taskStore.data = Object", and as it worked, we thought that it would be the same, with the dependencyStore. Apparently, it is not.

Thank you

Post by mats »

Ok, try to study the docs and look at the data types expected by our APIs, it's all described there.

Post by SIM-LTD »

Fair enough... Thank you

Post Reply