Our powerful JS Calendar component


Post by sukuna k »

In Week mode, the screen gets stuck while loading huge data when clicking the previous and next buttons.
Kindly review the runnable code and guide us on how to proceed further
I have attached a zip file of the runnable code. Please download it and navigate to the bryntum folder as shown in the screenshot,

Run the commands

  1. yarn then
  2. yarn storybook to launch Storybook.
    Bryntum_SupportForum_runnablecode_pagination.zip
    Zip file for runnable code
    (1.63 MiB) Downloaded 16 times

Post by ghulam.ghous »

Hi Sukuna,

I have checked and the freeze is not happening because of a large dataset but because you are rendering a huge amount of events on the same timespan which is realistically not possible and obviously does not have any use case. I have updated your example a bit to spread the 50000 events to spread across the timeline and it worked without any trouble. Please update the code of generateEvents with this and check for performance:

const generateEvents = (resourceCount: number, eventCount: number): Event[] => {
  const events: Event[] = [];

  for (let i = 1; i <= eventCount; i++) {
      const
        month         = Math.round(Math.random() * 12),
        day           = Math.round(Math.random() * 31),
        hour          = Math.round(Math.random() * 8) + 4,
        durationHours = Math.round(Math.random() * 71) + 1;
    const startDate = new Date(2022, month, day, hour).toISOString();
    const endDate = new Date(2022, month, day, hour+durationHours).toISOString();
    const event: Event = {
      id: i,
      startDate: startDate,
      endDate: endDate,
      name: `Event ${i}`,
      resourceId: `resource${(i % resourceCount) + 1}`,
      iconCls: i % 4 === 0 ? "b-fa b-fa-sun" : undefined
    };
    events.push(event);
  }

  return events;
};

Here's a clip:

Screen Recording 2024-07-23 at 1.54.08 PM.zip
(15.2 MiB) Downloaded 11 times

Post by sukuna k »

Thank you Ghulam, for your support and assistance.


Post Reply