Page 1 of 2

[INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 4:19 pm
by quandarycg

In gantt v.4.3.7 we catch update events and utilize it to catch the 'dataset' event. We utilize the 'dataset' event to manipulate some items on render. I noticed in the v5 update there is no more 'dataset' event. Is there an alternative event that is dispatched?


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 5:13 pm
by marcio

Hey quandarycg,

Probably you'll need to update the event to the change one.
https://www.bryntum.com/docs/gantt/api/Gantt/model/ProjectModel#event-change
https://www.bryntum.com/docs/gantt/api/Core/data/Store#event-change

You can also check what changes were made from one version to another here. https://www.bryntum.com/docs/gantt/api/apidiff


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 6:03 pm
by quandarycg

Even going off the v5 docs I see that "catchAll" event should still work yet on v4.3.7 this works:

bryntum.query('gantt').eventStore.on('catchAll', (event) => { console.log({event}) })

in v4, there are events logged to the console

and in v5, no events are logged to the console

Is there a new method to grab the 'dataset' event?


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 6:45 pm
by marcio

So, the dataset now is replaced by the change method, and became a parameter, as you'll see in the documentation. I used the snippet that you shared in the Gantt basic demo and worked just fine https://www.bryntum.com/examples/gantt/basic/ as you will see in the screenshot attached, perhaps you could share a sample project with your configuration to check what could be not working??


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 7:06 pm
by quandarycg

I see "action:remove". I get all other updates (remove, update, etc.), I am looking to get the event on render - which used to be 'dataset'. Do you see any events of "action:dataset" there?

End goal is to catch after the data is rendered and before a user makes any changes.


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 7:21 pm
by marcio

No, I don't see the dataset there. But to achieve your goal, you can use the load event.

https://www.bryntum.com/docs/gantt/api/Scheduler/data/EventStore#event-load

Or the dataReady event in projectModel

https://www.bryntum.com/docs/gantt/api/Gantt/model/ProjectModel#event-dataReady


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 9:13 pm
by quandarycg

Is the event-load supposed to be used like the other events?
This does not work:

                    bryntum.query('gantt').eventStore.on('load', (event) => { console.log(event) }

Yet the dataReady event works, yet it appears to return no event, is this by design?


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Tue Aug 09, 2022 11:09 pm
by marcio

Yes, the load event should work just like any other described in the documentation.

About the dataReady, yes, it returns the project, as also described in the documentation.

Could you please share your code for us to debug?? It'll make it easier for us to debug. Perhaps a sample project with your configuration would be very nice.


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Wed Aug 10, 2022 2:46 pm
by quandarycg

Our code has production data in it. Would you be able to get the #event-load to work and provide an example? I don't see how an event dispatching has to do with the project. Isn't it built in to dispatch events?

And to the point mentioned above: I tried the event-load and it is not dispatching like all the other events (update, remove, etc..)


Re: [INFO REQ] Gantt v5 - No more dataset event?

Posted: Wed Aug 10, 2022 10:22 pm
by marcio

Hi quandarycg,

Some events are dispatched in a specific context, so you need to set up the listener in the right context to work.

To configure that load event inside the event store, you can code like this

project : {
	...other configurations,
        eventStore : {
            listeners : {
                load : (event) => {
                    console.log('event', event);
                }
            }
        }
    }