Our state of the art Gantt chart


Post by omerkati »

Dear Bryntum,

I am trying to implement a mern stack and have a coupe of questions.

First, I can't figure out how the api is called when a sync request is made. I tried all methods like GET, POST and PUT, but my express server does not see any request coming in.

App config:


transport: {
    load: {
        url: 'http://localhost:5000/record/',
        method: 'GET',
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Content-Type': 'application/json',
            "credentials": "same-origin"
        },
        failure: (e) => {
            console.log(e)
        },
        sync : {
            url : 'http://localhost:5000/record/save'
        }
    }
},
autoLoad: true,
autoSync: true,

express node server:

recordRoutes.route("/record/save").post(function (req, res) {
    let db_connect = dbo.getDb("bryntum");
    db_connect.collection("records")
        .findOne({},(function (err, result) {
            if (err) throw err;
            console.log(result);
        }));

const myObj = {
    success: true,
    requestId: req.body.requestId,
    revision: req.body.revision,
}
res.json(myObj);

});

My next question is if it is possible to have a Gantt without the Project flag at the start and at the end. Maybe I should switch to scheduler pro for this functionality. The Gantt resource-utilization demo has most of the functionality that we are looking for that is why I wanted to use that. Is it possible to add the tree like structure and add people to certain tasks in the scheduler pro utilization function? Basically to have all the functionality of Gantt resource-utilization demo but in the scheduler pro so that individual tasks do not need to be connected to each other or be part of a larger project.

If you have an example of a MERN stack that would be greatly appreciated as well.

Best regards and thank you,
Ömer


Post by Animal »

First thing is take a look at the Network tab in the debugger to see what request has been sent to where:

Screenshot 2022-08-18 at 11.27.02.png
Screenshot 2022-08-18 at 11.27.02.png (138.94 KiB) Viewed 93 times

Post by marcio »

Hey Ömer,

  • It looks like your sync URL is in the wrong place, it should be in the same level of the load property, not inside of it.

    transport: {
        load: {
            url: 'http://localhost:5000/record/',
            method: 'GET',
            headers: {
                'Access-Control-Allow-Origin': '*',
                'Content-Type': 'application/json',
                "credentials": "same-origin"
            },
            failure: (e) => {
                console.log(e)
            }
        },
        sync : {
    	url : 'http://localhost:5000/record/save'
        }
    },

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

  • Could you clarify more about what you want to achieve regarding the resource utilization example? The data in the example is already tree-structured and is already using schedulerPro

Best regards,
Márcio


Post by omerkati »

Ah thank you. I did not see that mistake, it works now. For now I know enough and being able to remove the flags is a big addition


Post Reply