Our pure JavaScript Scheduler component


Post by Aniket »

Team,

I want to post the change user makes on the scheduler on click of a button using crudmanager.

Basically I dont want to set autoSync to true.

How may I send the changes to server without using autosync feature?


Post by mats »

Please try looking in our docs / guides first: It's easy to find usually. https://bryntum.com/docs/scheduler/#Scheduler/crud/AbstractCrudManagerMixin#function-sync


Post by Aniket »

Mats,

It isnt clear, when/how to call the sync manually

To add Mats, Which approach would you suggest?

To post each individual change to server with autoSync?

or send all of them at a click of a save button?


Post by Maxim Gorkovsky »

You should know better as it depends on the application. Both approaches have pros and cons. Syncing on button click would allow you to benefit from undo/redo feature as you can see in this demo: https://www.bryntum.com/examples/scheduler/undoredo/


Post by Aniket »

Maxim,

I am posting changes on button click using below code, Do i need to make any changes in crudManager block as well to re render the saved changes?

Below is the save button call to post changes


save() {

this.scheduler.schedulerEngine.crudManager.sync().then(
  () => console.log("Changes posted..."),
  ({ response, cancelled }) => console.log(`Error: Saving changes failed`)
  );
  }

CrudManager block :-

crudManager = {

listeners: {
  load({ response }) {
    console.log(response);
  
    const
      start = new Date(response.calendar.startDate),
      end = new Date(response.calendar.endDate)
    //    childid = response.details.childId
    //   parentid = response.details.parentId
    // console.log(childid),
    // console.log(parentid),
    this.scheduler.setTimeSpan(start, end);
   },

  beforeResponseApply: ({ response }) => {
    response.resources.rows = response.resources.vehicles;
    response.events.rows = response.events.tests;
  }
},
autoLoad: true,
autoSync: false,
transport: {
  load: {

    url: './api/data/get'
  },

  sync: {
    url: './api/data/save',
  },


}

  }

Post by mats »

No, no extra render calls are needed after a sync.


Post by Aniket »

ok Mats, The object which gets posted to backend with autoSync : true is different to the one gets sent on a manual sync call on button click.


Post by mats »

Ok, sounds strange.


Post by Aniket »

mats, Need your expertise to understand a scenario.

  1. user makes a drag drop operation.
  2. user again makes a resize operation.

User clicks a save button to post the changes and eventually sync method gets called.

Will both/all changes get posted at once or after making each individual change user should hit the save button to call sync operation?


Post by mats »

Will both/all changes get posted at once or after making each individual change user should hit the save button to call sync operation?

That's up to you, you can use autoSync (no save button) or manual save upon click. Your application => you decide.


Post Reply