renderScheduleEvent, more information on underlying dom element... pixel size

I am using renderScheduleEvent on the Eventcalendar and need to conditionally render items depending on how large (pixels) the event is on the calendar. I see position is within MbscCalendarEventData however I need more information to correctly calculate the event’s true pixel size given the position’s height and width percentages.

I tried using the ref off of Eventcalendar but that is not the events’ parent and the percentages against the Eventcalendar offsets do not suffice. Do you have a way or example of figuring out how large the event is?

Please let me know if this question is not clear, I can provide an example.

Hi @jwl,

If you could provide an example with a bit of explanation, that would be great, thanks!

If you’re using react, I manage to do that with the useRef hook and the myRef.current.clientWidth property.

const [chipDirection, setChipDirection] = useState(“row”);
useEffect(() => {
if (myRef.current !== null && myRef.current.clientWidth < 50)
}, []);

Hope it will help !

1 Like