Our pure JavaScript Scheduler component


Post by michael cohen »

I have this pice of code im reusing:

  private setResourceFilter(filterName: string, filterByFunction: Function): void {
    this.schedulerComponent?.instance.resourceStore.removeFilter(filterName);
    this.schedulerComponent?.instance.resourceStore.addFilter({
      filterBy: filterByFunction,
      id: filterName
    })
  }

it look a bit laggy so if checked:


  const relevantResources = (this.schedulerComponent.instance.eventStore.getEvents({
    startDate: _startDay,
    endDate: _endDay
  }) as any)?.map(event => event.data.resourceId);
  let t0 = performance.now();

  this.setResourceFilter(SchedulerFilterType.selectedDate, (resource) => {
    return relevantResources?.length && (relevantResources as string[]).includes(resource.id);
  });
  let t1 = performance.now();

  console.log(t1-t0);

console returns:
216
197
212

am I using it wrong?
this is the performance?


Post by mats »

Doing remove then add like that will trigger double re-rendering, try using the silent flag for your remove call:

https://bryntum.com/docs/scheduler/api/Core/data/mixin/StoreFilter#function-removeFilter

Does that speed things up?


Post Reply