Premium support for our pure JavaScript UI components


Post 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?


Post 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

Best regards,
Márcio


Post 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?


Post 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??

Attachments
Screen Shot 2022-08-09 at 1.41.10 PM.png
Screen Shot 2022-08-09 at 1.41.10 PM.png (260.05 KiB) Viewed 314 times

Best regards,
Márcio


Post 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.


Post 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

Best regards,
Márcio


Post 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?


Post 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.

Best regards,
Márcio


Post 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..)


Post 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);
                }
            }
        }
    }

Best regards,
Márcio


Post Reply