hbatalhaStch / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers
https://stephenchou1017.github.io/scheduler/#/
MIT License
21 stars 8 forks source link

Scheduler headers (dates) default to left but content cells default to right when re-rendered in React #29

Open fabiansvensson opened 10 months ago

fabiansvensson commented 10 months ago

Checklist

Please make sure the question is worded well enough to be understood

I have two views, one table checklist where the user can add resources to the scheduler, and the scheduler itself. Whenever I move to the table checklist and back, the dates of the Scheduler default to start of the month (1,2,3,4,5...). But the cells with content default to end of the month (27,28,29,30...). See image:

Screenshot 2023-11-27 at 23 03 26

As soon as I scroll to the left just a little bit, the issue is corrected, and the correct dates are displayed (27, 28, 29, 39...):

Screenshot 2023-11-27 at 23 04 19

Any idea what might be causing this? This is my Scheduler code:

<Scheduler
            prevClick={prevClick}
            nextClick={nextClick}
            onSelectDate={onSelectDate}
            onViewChange={onViewChange}
            toggleExpandFunc={toggleExpandFunc}
            eventItemClick={(sd: SchedulerData, eventItem: EventItem) => {
                const idx = schedulerData.resources.findIndex((r: any) => r.id == eventItem.resourceId);
                const personName = idx >= 0 ? schedulerData.resources[idx].name : '';
                //@ts-ignore
                props.onShowAddEvent(eventItem.resourceId, personName, eventItem.start, eventItem.end, eventItem.meta.batch)
            }}
            schedulerData={schedulerData}
            updateEventEnd={updateEventEnd}
            newEvent={newEvent}
            parentRef={props.parentRef}
            nonAgendaCellHeaderTemplateResolver={nonAgendaCellHeaderTemplateResolver}
/>

The configuration I've added is basically this: responsiveByParent: true, schedulerMaxHeight: 300, resourceName: t('addworkorder:persons', "Persons") as string, taskName: t('addworkorder:task_name', "Task name") as string, nonAgendaDayCellHeaderFormat: 'HH:mm', nonAgendaOtherCellHeaderFormat: 'ddd|M/D', views: [ {viewName: t('addworkorder:month', "Month") as string, viewType: ViewType.Month, showAgenda: false, isEventPerspective: false}, {viewName: t('addworkorder:quarter', "Quarter") as string, viewType: ViewType.Quarter, showAgenda: false, isEventPerspective: false}, {viewName: t('addworkorder:year', "Year") as string, viewType: ViewType.Year, showAgenda: false, isEventPerspective: false}, ],

zzy-life commented 1 day ago

I also reproduced this problem, did you solve it? @fabiansvensson

zzy-life commented 1 day ago

And it only occurs in the Edge browser