Our pure JavaScript Scheduler component


Post by krazibit »

I'm trying to replace events in the event store using the method below, but it takes about 40 seconds for 450 events.

scheduler.mask('Updating Events ...')
scheduler.suspendRefresh()
console.time('AdaptPhysicalRoomsToEventRows')
const roomEvents = GridHelper.AdaptPhysicalRoomsToEventRows(physicalRooms)
console.timeEnd('AdaptPhysicalRoomsToEventRows')
console.log('events', roomEvents.length)
scheduler.eventStore.beginBatch()
scheduler.eventStore.removeAll()
scheduler.eventStore.add(roomEvents)
scheduler.eventStore.endBatch()
console.time('resuming refresh')
scheduler.resumeRefresh(true).then(() => {
  console.timeEnd('resuming refresh')
  scheduler.unmask()
})

I see from the bigdataset example that the whole scheduler.project was replaced when changing data, this approach is not desirable for me as I need to have eventstore reference between the changes due to event listeners attached.

Is the another more performant way of replacing store data?

PS. on first load using the same method above it's quite fast.


Post by mats »

You could replace those lines with just this:

scheduler.eventStore.data = roomEvents;

Post by krazibit »

Yeah, tried that and got the error below

index.js:1 Error Initializing Events TypeError: Cannot use 'in' operator to search for 'stores' in undefined
    at _0x261d8e.get (scheduler.module.js:10)
    at _0x261d8e.get [as stores] (scheduler.module.js:10)
    at _0x261d8e.triggerBeforeUpdate (scheduler.module.js:10)
    at _0x261d8e.inSet (scheduler.module.js:10)
    at _0x261d8e.inSet (scheduler.module.js:87)
    at _0x261d8e.set (scheduler.module.js:10)
    at _0x261d8e.set [as _internalId] (scheduler.module.js:10)
    at _0x261d8e.construct (scheduler.module.js:10)
    at new Base (scheduler.module.js:10)
    at new _0x1b92d7 (scheduler.module.js:10)
    at new _0x4a917a (scheduler.module.js:10)
    at new Model (scheduler.module.js:10)
    at new TimeSpan (scheduler.module.js:87)
    at new _0x31d8df (scheduler.module.js:87)
    at new _0x57136d (scheduler.module.js:87)

Post by alex.l »

Hi krazibit,

It looks strange. Could you please attach a runnable test case here or try to reproduce it with our examples, maybe modify it a bit?

All the best,
Alex

All the best,
Alex


Post Reply