Our state of the art Gantt chart


Post by ggalipeau »

My project Model is currently setup like this:

 this.project = new ProjectModel({      
transport : {
load : { url : this.props.loadURL, headers : {'Content-Type' : 'application/json'},
params : {
projectID : projectID } } });

I pass my projectID up in the params to get the data.

We need to be able to switch the projectID on our User Interface to reload the Gantt.

Is there any way to reload the data in the Gantt?

I tried this so far with no luck:

  1. Re-ran my code to load the ProjectModel again. But, I got gantt errors when I did this. Makes sense. The gantt is already tied to a ProjectModel. If I re-run the code above, it makes sense it breaks.

  2. I also tried this below:

      private reLoadProject = (projectID: string): void => {   
    this.setState({projectID: projectID}); this.project.onBeforeLoad = ({ pack }) => {
    Object.assign(pack, { projectID : projectID }); };
    this.project.load(); }

That almost worked. It actually called my server side with the new projectID. But, it didn't refresh the Gantt when the load was finished.

Anyways, just looking to reload the data and refresh the Gantt with the newly loaded data.

Thanks,
Greg


Post by mats »

This should do it, docs: https://bryntum.com/docs/gantt/#Gantt/model/ProjectModel#function-load

// Pass params as part of the load call
project.load({ 
    request : {
        params : {
            startDate : '2021-01-01'
        }
    }
})

Post Reply