Our state of the art Gantt chart


Post by wzantout »

Hello,

I'm not sure if this question makes a lot of sense, but can I exclude some stores from the load request? In my case, I'm not using resources, assignments and timeRanges.

data={"type":"load","requestId":17227625333220,"stores":["calendars","tasks","dependencies","resources","assignments","timeRanges"]}

Can you please explain to me the purpose of sending this? Does it really matter what I send? Does the backend API needs this?

Thanks!


Post by khattakdev »

Hey there,

can I exclude some stores from the load request?

You can exclude it from the load request if you don't need it on the front end.

You can also load the specific store data separately. For example, you can use taskStore if you only need tasks.

const gantt = new Gantt({
  taskStore: {
    autoLoad: true,
    readUrl: "load",
  },
});

Arsalan
Developer Advocate


Post by wzantout »

Thanks for the response. Can you please provide an example on this?

You can exclude it from the load request if you don't need it on the front end.

Last edited by wzantout on Mon Aug 05, 2024 10:29 am, edited 2 times in total.

Post by khattakdev »

Here's an example of load response structure that you can find in the docs:

{
    "success" : true,

"project" : {
    "calendar"     : 10,
    "startDate"    : "2019-01-14",
    "hoursPerDay"  : 24,
    "daysPerWeek"  : 5,
    "daysPerMonth" : 20
},

"calendars" : {
    "rows" : [
        {
            "id"        : 10,
            "name"      : "General",
            "intervals" : [
                {
                    "recurrentStartDate" : "on Sat at 0:00",
                    "recurrentEndDate"   : "on Mon at 0:00",
                    "isWorking"          : false
                }
            ]
        }
    ]
},

"dependencies" : {
    "rows" : [
        {
            "id"      : 1,
            "from"    : 11,
            "to"      : 17,
            "type"    : 2,
            "lag"     : 0,
            "lagUnit" : "d"
        }
    ]
},

tasks : {
    "rows" : [
        {
            "id"          : 11,
            "name"        : "Investigate",
            "percentDone" : 50,
            "startDate"   : "2021-02-08",
            "endDate"     : "2021-02-13",
            "duration"    : 5
        },
        {
            "id"          : 12,
            "name"        : "Assign resources",
            "percentDone" : 50,
            "startDate"   : "2021-02-08",
            "endDate"     : "2021-02-20",
            "duration"    : 10
        },
        {
            "id"          : 17,
            "name"        : "Report to management",
            "percentDone" : 0,
            "startDate"   : "2021-02-20",
            "endDate"     : "2021-02-20",
            "duration"    : 0
        }
    ]
},

"resources" : {
    "rows" : [
        {
            "id"   : 1,
            "name" : "Mats"
        },
        {
            "id" : 2,
            "name" : "Nickolay"
        }
    ]
},

"assignments" : {
    "rows" : [
        {
            "id"       : 1,
            "event"    : 11,
            "resource" : 1,
            "units"    : 80
        }
    ]
}
}

If I only need need tasks, the response would look like:

{
    "success" : true,
    tasks : {
        "rows" : [
            {
                "id"          : 11,
                "name"        : "Investigate",
                "percentDone" : 50,
                "startDate"   : "2021-02-08",
                "endDate"     : "2021-02-13",
                "duration"    : 5
            },
            {
                "id"          : 12,
                "name"        : "Assign resources",
                "percentDone" : 50,
                "startDate"   : "2021-02-08",
                "endDate"     : "2021-02-20",
                "duration"    : 10
            },
            {
                "id"          : 17,
                "name"        : "Report to management",
                "percentDone" : 0,
                "startDate"   : "2021-02-20",
                "endDate"     : "2021-02-20",
                "duration"    : 0
            }
        ]
    },

}

Arsalan
Developer Advocate


Post by wzantout »

Thanks again for the response. We're talking about the load request and not the response. I noticed the following param gets serialized and added to the load URL:

data={"type":"load","requestId":17227625333220,"stores":["calendars","tasks","dependencies","resources","assignments","timeRanges"]}

My two questions here are:

1- How can I exclude some stores from stores property above?
2- What's the purpose of data param?

Ref: https://bryntum.com/products/gantt/docs/api/Scheduler/crud/transport/AjaxTransport#config-transport


Post by khattakdev »

Sorry for the confusion.

How can I exclude some stores from the stores property above?

You can use the beforeLoad event to modify the stores there. Learn more https://www.bryntum.com/products/gantt/docs/api/Scheduler/crud/AbstractCrudManager#event-beforeLoad.

What's the purpose of data param?

The data param has info like the list of stores, which can be useful for the server-side implementation, for example, if you want to load only certain stores.

Arsalan
Developer Advocate


Post by alex.l »

Hi,

You also can remove store from CRUD manager if don't need to track it at all
https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#function-removeCrudStore

All the best,
Alex


Post by wzantout »

Got it, thank you, both!


Post Reply