Our state of the art Gantt chart


Post by SIM-LTD »

Hi

Our process requires to listen to every change that occurs in both "TaskStore" and "DependencyStore".

With "TaskStore" the data structure returned are the same, whenever in the taskStore an event is "Added" "Updated" or "Deleted".

BUT :roll: with the "DependecyStore" we noticed that the data Structure returned are different
(Please have a look at the screenshot to have a clear understanding)
The Data Structure does not mean the value itself but the type of data returned.

As a matter of fact :
1) When a dependency is "Added" then the event returns 2 main properties :
- Data ------------------> This property contains the layout of the dependency (how it is drawn) (fromSide, toSide)
- OriginalData -----> This property contains the data structure matches the record set and where all new value
can be retrieved, so as to perform Database create (fromEvent / toEvent) Why here :?:

2) When a dependency is "Updated " then the event returns 1 main property:
- Data --------> Where the data structure matches the record set and where all updated value can be retrieved;
so as to perform a Database update. (as the TaskStore we think this is the right place to retrieve data value)

In conclusion, we wonder whether this is done on purpose or if this is a mistake because with the TaskStore we do not need to switch between "data" or "original data" since the event returned, gives us the right recordset and value in the property "data".

This is not a big deal since we can monitor the type of change that occurs in the dependencyStore; but in term of coherence, this does not make sense to retrieve the value in the property "OriginalData" when a dependency is ADDED :!:

To complete our post, since we want to be more precise.
When a dependency is added we have to grab values from :
  event.originalData.fromEvent.id
  event.originalData.toEvent.id
  event.data.type
  event.data.lag
  
Attachments
Capture d’écran 2019-06-24 à 08.28.14.png
Capture d’écran 2019-06-24 à 08.28.14.png (65.01 KiB) Viewed 1710 times
Capture d’écran 2019-06-24 à 08.27.43.png
Capture d’écran 2019-06-24 à 08.27.43.png (88.54 KiB) Viewed 1710 times
Capture d’écran 2019-06-24 à 08.32.44.png
Capture d’écran 2019-06-24 à 08.32.44.png (84.49 KiB) Viewed 1710 times

Post by pmiklashevich »

Please open Basic demo and run in console:
gantt.dependencyStore.on('change', ({ action, records }) => {
    console.log(action, records && records[0])
})
Then drag create a new dependency
2019-06-26_1757.png
2019-06-26_1757.png (334.15 KiB) Viewed 1679 times
and see the output
2019-06-26_1745.png
2019-06-26_1745.png (240.33 KiB) Viewed 1679 times
You can see that fromEvent/toEvent are there. Basically you receive a dependency record or an array of dependency records:
https://www.bryntum.com/docs/gantt/#Gantt/data/DependencyStore#event-update
https://www.bryntum.com/docs/gantt/#Gantt/data/DependencyStore#event-add

Pavlo Miklashevych
Sr. Frontend Developer


Post by SIM-LTD »

Hi Pavel

Thank you very much for having run that test case.
As we develop with VueCLI, we do not know whether we have the same Hook life cycle than under pure JS

Meaning that, if you pay attention to our screenshot :
1- the properties "fromEvent / toEvent" are missing in the returned value " ... records[0].data" for "ADD" event
2- the properties "fromEvent / toEvent" are present in the returned value " ... records[0].data" for "Update" event

Then when a dependency is added, we have to retrieve the "fromEvent/toEvent" from the returned value call"originalData"! Which you'll agree is pretty much strange to see "originalData" when a record is added.

Just to let you know that our screenshot result, same from the same code you mentioned to wit :
gantt.dependencyStore.on('change', ({ action, records }) => {
    console.log(event)
})
which contains those properties action, records && records[0], etc...

We are going to move forward in our dev and get back to you with further information.
But if you have a couple of minutes :D just add the same code in the sample 'sch-gnt' you have made (Scheduler_Gantt) and let us know your result (PLEASE, if you do that, your sample must be done with VueCLI)


Most of the issue we raised here are coming from our app that contains both Scheduler & Gantt module.
Thank you

Post by pmiklashevich »

Hello,
Then when a dependency is added, we have to retrieve the "fromEvent/toEvent" from the returned value call"originalData"! Which you'll agree is pretty much strange to see "originalData" when a record is added.
I have no idea how to reproduce what you see. Please provide a solid testcase or instructions.
But if you have a couple of minutes :D just add the same code in the sample 'sch-gnt' you have made (Scheduler_Gantt) and let us know your result
I expected your request to test it against scheduler+gantt internal demo, so I tested it in advanced and it worked the same way good.
PLEASE, if you do that, your sample must be done with VueCLI
We have to narrow all problems down to pure JS to get them fixed in our source code and not in the application. The problem you described has to have similar effect in our basic examples. If it's reproducible only in your application that means that some circumstances make the result what you described. So only a valid testcase can help to find the reason.
We are going to move forward in our dev and get back to you with further information.
Looking forward to hearing from you! Indeed, need more info from you to be able to help.

Best regards,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by SIM-LTD »

Hi

With the new release Gantt 1.1.1 both fields "fromEvent" "toEvent" are now present.
We double checked and those were missing in the "records[0].data" value returned from DependencyStoreOnChange, when adding a dependency.

Then this is solved with the last release.

Thank you
Attachments
Capture d’écran 2019-06-27 à 22.59.13.png
Capture d’écran 2019-06-27 à 22.59.13.png (72.02 KiB) Viewed 1651 times

Post by pmiklashevich »

Glad to hear it! :)

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply