Our pure JavaScript Scheduler component


Post by omerkati »

Dear Bryntum,

Is there an example of how to use a crudmanager to send requests with two stores? I read the documentation https://www.bryntum.com/docs/scheduler/guide/Scheduler/data/crud_manager, but noticed that the way it is implemented in react is different. Could you please show me how to use the crudmanager in react to send and receive data.

best regards,
Ömer


Post by saki »

Well, all React examples use more than one store – at least eventStore and resourceStore. One of the simplest is https://bryntum.com/examples/scheduler/frameworks/react/javascript/animations/build/

The configuration is in AppConfig.js as:

    crudManager: {
        autoLoad: true,
        transport: {
            load: {
                url: 'data/data.json'
            }
        },
        // This config enables response validation and dumping of found errors to the browser console.
        // It's meant to be used as a development stage helper only so please set it to false for production systems.
        validateResponse : true
    },

You can also configure sync in transport to have Scheduler send data to the server. If you do so, you will see that the sent data are from all stores.


Post by omerkati »

Hi Saki,

My bad I meant that I have two schedulers. We want to keep both of them in sync. I however think that it is better now to have two separate crud managers and sync at the same time. Is this good practice?


Post by alex.l »

Hi omerkati,

This is just a business logic question. But your last idea sounds much better!

All the best,
Alex


Post by omerkati »

Hi is there an example where a sync request is send in react? We are trying to make a backend but I do not fully understand where to put the autosync: true property or how to sync in general.

https://www.bryntum.com/docs/scheduler/api/Scheduler/crud/AbstractCrudManagerMixin#function-sync

I can not seem to access this AbstractCrudManagerMixin function either. Any help would be greatly appreciated.


Post by alex.l »

Hi omerkati,

It is not important which framework do you use to wrap our components, all the configs are incapsulated inside. It will work if you provided URLs


features : {
	// ...
},
crudManager : {
    transport : {
        load : {
            url       : 'php/read.php',
            paramName : 'data'
        },
        sync : {
            url : 'php/sync.php'
        }
    },

    autoLoad      : true,
    autoSync      : true
},

We have an example here: https://bryntum.com/examples/scheduler/crudmanager
if autoSync is enabled, there is no need to do sync manually, but you still may call a method:

scheduler.crudManager.sync();

The guide is here: https://bryntum.com/docs/scheduler/guide/Scheduler/data/crud_manager

All the best,
Alex


Post by omerkati »

Hi again,

I am mostly a frontend developer and that is why I do no understand much about php. We have a rust backend that we want to use for these sync and load requests. I am wondering now what type of request is send because my scheduler is not sending anything.

crudManager: {
        autoSync: true,
        autoLoad: true,
        // transport: {
        //     load: {
        //         url: 'data/data.json'
        //     }
        // },
        sync: {
            url: 'customurl',
            // specify Content-Type for requests
            headers: {
                'Content-Type': 'application/json'
            },
        },
        // This config enables response validation and dumping of found errors to the browser console.
        // It's meant to be used as a development stage helper only so please set it to false for production systems.
        validateResponse: true,
    },

I get an error saying that says this:

Uncaught TypeError: me.sync is not a function
at CrudManager.<anonymous> (:3000/static/js/0.chunk.js:167239:24)
at :3000/static/js/0.chunk.js:64120:22

I do not understand whats going on. Maybe it will be better just to save the events using axios?


Post by Animal »

You are overwriting the CrudManager's sync method with that object you are configuring it with, so when it comes to call it, it throws that error.

The URLs to use go into its transport config.

https://www.bryntum.com/docs/scheduler/api/Scheduler/data/CrudManager#scheduler-stores


Post by omerkati »

Thank you it is sending requests now is there a guide on how to handle the receiving side of the sync request? All it is doing is asking for options.


Post by Maxim Gorkovsky »

All it is doing is asking for options.

Could you please elaborate on that? Who is asking options and how?

Please check this guide on crud load/sync request formats: https://www.bryntum.com/docs/scheduler/guide/Scheduler/data/crud_manager#sync-request-structure


Post Reply