Page 1 of 1

[REACT] SchedulerPro - eventRenderer Props

Posted: Tue Mar 21, 2023 10:56 pm
by mightym

Is there a way in the custom event renderer to receive props from the event about if it is selected, is dragged, resized etc?


Re: [REACT] SchedulerPro - eventRenderer Props

Posted: Wed Mar 22, 2023 9:28 am
by alex.l

Hi,

if it selected

there is scheduler.selectedRecords property to check that.
https://bryntum.com/products/schedulerpro/docs/api/Grid/view/mixin/GridSelection#property-selectedRecords

is dragged, resized etc?

Not sure about these 2. You can check scheduler.project.changes or eventStore.changes to see if any values changed in the record.
https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/data/EventStore#property-changes
https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/model/ProjectModel#property-changes
There is no universal answer for all, you can find the way to check that, but you need to have more specific requirements.

Also be aware that renderer triggers only when event needs to be re-rendered.
https://bryntum.com/products/schedulerpro/docs/api/Scheduler/view/mixin/SchedulerEventRendering#config-eventRenderer


Re: [REACT] SchedulerPro - eventRenderer Props

Posted: Wed Mar 22, 2023 12:28 pm
by mightym

Yeah I feared that. My hope was that in:

const eventRenderer = ({
  eventRecord,
  resourceRecord,
  assignmentRecord,
  renderData,
}) => {
  return (
    <EventItem
      key={assignmentRecord.id}
      eventRecord={eventRecord}
      resourceRecord={resourceRecord}
    />
  );
};

maybe renderData or eventRecord would pass me the information. But I realized that these are not updated eg on resize and there are anyway no props about "isDragging" "isResizing" "isSelected" etc ...


Re: [REACT] SchedulerPro - eventRenderer Props

Posted: Wed Mar 22, 2023 8:44 pm
by marcio

Hey mightym,

Perhaps using the event listeners like this one https://bryntum.com/products/schedulerpro/docs/api/Core/helper/DragHelper#event-dragStart and handling from there which event is being dragged would do the trick for you?