Our state of the art Gantt chart


Post by akuang »

Hi all,

I have an Action Column in out Gantt chart which renders the number of comments for a task. Our application has a comment pane that is laid on top of the Gantt chart after interacting with that Action. The comment pane is external from the Gantt component. If a user enters a new comment, then I want the cell which renders the number of comments to reflect the new count. Is there a way that an external data source and do a sort of ad-hoc onSync/onLoad response to update an existing task's data?

Thanks!


Post by pmiklashevich »

Hello,

As soon as you update the task record, the data will be rendered on the screen. If you load tasks and comments from different sources and you need to update tasks data on load, please see beforeLoadApply and beforeSyncApply events. They are supposed to be used as hooks to modify raw response before it gets applied to the store.

Best,
Pavel

P.S. Here you can find general guidelines on how to ask for help more effectively: viewtopic.php?f=35&t=772 A testcase, schreenshots, and product version help to understand your problem much faster.

Pavlo Miklashevych
Sr. Frontend Developer


Post by akuang »

Thank you for your reply. Sorry if my question did not convey the request properly.
Using bryntum-gantt version 2.1.9

I'll try to describe the situation a bit differently.

When a user loads our application then we initialize the Gantt component. On render it calls onLoad, and our application returns the data to the Gantt component and renders the data as expected.
We have an Action Column that displays a comment bubble icon with the number of comments related to this task. See below:

Gantt Task Comments.png
Gantt Task Comments.png (102.78 KiB) Viewed 1040 times

When a user invokes the action, then it triggers a callback which renders a component outside of the Gantt component, which used for viewing and adding comments. When the user creates a new comment in this external component, then we want to push this new comment count into the Task's store.

From what I have seen, the only way to update the store is from an onSync or onLoad response. Though, in the above example, there is no onSync or onLoad request to respond to when this comment count changes.
Any subsequent onSync requests will include the new comment count in the response and update the Task's store as expected, but I was hoping to be able to push these changes to the store without requiring an onSync/onLoad request.

Hopefully that helps explain the information request a bit better.


Post by arcady »

akuang wrote: Wed Sep 16, 2020 6:54 pm

When the user creates a new comment in this external component, then we want to push this new comment count into the Task's store.

Are you asking how to update a field of a store record?
If yes then ..let's say you have commentCount field:

task.set('commentCount', 123)

or you can update many fields by one call if you need:

task.set({
    commentCount' : 123,
    weight : 100,
    age : 50
})

the method docs: https://bryntum.com/docs/scheduler/#Core/data/Model#function-set

to get a certain record by its identifier:

store.getById(5)

docs: https://bryntum.com/docs/scheduler/#Core/data/Store#function-getById


Post by akuang »

Thanks @arcady. This pointed me in the right direction. I was thinking that there might be some other hook I could expose from the Bryntum Gantt Engine, similar to onSync or onLoad. Exposing the engine's store itself works for me in order to make updates directly on a task works for me. I will move forward with this approach. Thanks for your patience and thoughtful responses!


Post Reply