Our pure JavaScript Scheduler component


Post by deveshwaar »

I'm working with a component where I'm passing events and resources directly as props to the SchedulerEventsProjectModel instead of using a CRUD manager. The component re-renders through a useSelector statement connected to Redux.

What I need to know: What are the available options that would trigger an event when I add events and resources to this model?

const SchedulerEventsProjectModel = forwardRef<
  BryntumSchedulerProProjectModel,
  {}
((_props, ref) => {
  console.log('@SchedulerEventsProjectModel');
  const { schedulerEventsProjectRef } = useRmsGridInstance();
  const { schedulerEvents, schedulerResources } = useSelector(
    selectAllUnallocatedTasksByContext
  );

  // Custom hooks
  useEventProjectProcess();
  useImperativeHandle(ref, () => schedulerEventsProjectRef.current);



  return (
    <BryntumSchedulerProProjectModel
      ref={schedulerEventsProjectRef}
      {...EventsProjectConfig}
      resources={schedulerResources}
      events={schedulerEvents}
      listeners={{
        load: () => {
          console.log('🤣 ');
        },
      }}
    />
  );
});

export default React.memo(SchedulerEventsProjectModel);

Post by ghulam.ghous »

Sorry I do not understand. You can apply any event listener you want using the listeners prop on the projectModel: https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/model/ProjectModel#config-listeners

But I would recommend to defined the listeners either in a static file and use them or use useState hook to define them to make sure they are not re-applied on each re-render. Here is the best practices guide: https://bryntum.com/products/schedulerpro/docs/guide/SchedulerPro/integration/react/guide#best-practices-for-configuration-management


Post Reply