Premium support for our pure JavaScript UI components


Post by quandarycg »

I added this - no errors and also no log of 'load' event. Here is my code:

const gantt = new bryntum.gantt.Gantt({
    project,
    rowHeight: 20,
    barMargin: 2,
    flex: 1,
    startDate: self.startDate,
    appendTo: "gantt",
    viewPreset: 'weekDateAndMonth',
    maxZoomLevel: 9,
    features: {
        labels: {
            left: {
                field: 'name',
                editor: {
                    type: 'textfield'
                }
            }
        },
    },
    eventStore: {
        listeners: {
            load: (event) => {
                console.log('event', event);
            }
        }
    },
    columns: [
        { type: 'wbs', persist: true, editor: false },
    ],

});

Post by marcio »

Hey, the eventStore should be inside the project config

const gantt = new bryntum.gantt.Gantt({
    project: {
    	...project,
    	eventStore: {
        	listeners: {
            		load: (event) => {
                		console.log('event', event);
            		}
        	}
    	}
    },
    rowHeight: 20,
    barMargin: 2,
    flex: 1,
    startDate: self.startDate,
    appendTo: "gantt",
    viewPreset: 'weekDateAndMonth',
    maxZoomLevel: 9,
    features: {
        labels: {
            left: {
                field: 'name',
                editor: {
                    type: 'textfield'
                }
            }
        },
    },
    columns: [
        { type: 'wbs', persist: true, editor: false },
    ],
});

Best regards,
Márcio


Post by quandarycg »

Thank you, so I've added it to the project config and am getting the same result - no log of event. Here is my code:

const project = new bryntum.gantt.ProjectModel({

"eventsData": main_structured_events,

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

"dependenciesData": dependenciesData,

"resourcesData": main_resources,

"assignmentsData": main_assignments,

validateResponse: true
});

Post by tasnim »

Could you please provide a runnable test case so we can debug it?


Post by quandarycg »

Could you copy the demo gantt code and try to get the onload event to work? Once you can get an event to log on load in the console then I can reuse the solution.


Post by marcio »

Hey,

I just shared the code of our basic latest version Gantt demo with the eventStore load listener working correctly (as you see in the attached screenshot).

Attachments
Screen Shot 2022-08-15 at 2.32.38 PM.png
Screen Shot 2022-08-15 at 2.32.38 PM.png (167.93 KiB) Viewed 423 times
app.js.zip
(634 Bytes) Downloaded 38 times

Best regards,
Márcio


Post by quandarycg »

I see, so I am loading in tasks through "eventsData" and then trying to also have an "eventStore" property on the project. Would this be a possible issue with why I am not seeing the event dispatch? If so, how can I pass both eventsData (array of data) and eventStore( for data onload event listener)?

const project = new bryntum.gantt.ProjectModel({
    eventsData: main_structured_events,
    eventStore: {
        listeners: {
            load: (event) => {
                console.log('event', event);
            }
        },
    },
});

Post by quandarycg »

Instead of setting up the project using the ProjectModel, I've moved the configs to be directly in the gantt like so:

const gantt = new bryntum.gantt.Gantt({
                        project : {
                            autoLoad  : true,
                            transport : {
                                load : {
                                    url : 'https://our-hosted-url.com/bryntum-gantt-v5.1.1/gantt-5.1.1/examples/_datasets/launch-saas.json'
                                }
                            },
                            eventStore : {
                                listeners : {
                                    load : (event) => {
                                        console.log('load event store', event);
                                    }
                                }
                            }	
                        }
                        }

This works. So it appears that if we load the data using 'transport' via URL, this 'load' event listener works. Is there a method to load in the actual project data instead of a URL and still have the 'load' event dispatch?


Post by marcio »

Oh, ok, perhaps you can use the https://bryntum.com/docs/gantt/api/Gantt/model/ProjectModel#event-dataReady

or in the Gantt configuration level (not inside project configuration), you can use https://bryntum.com/docs/gantt/api/Grid/view/GridBase#event-renderRows

Best regards,
Márcio


Post Reply