Our powerful JS Calendar component


Post by lanpeng »

Hi bryntum .
In my project .I want to get the Eventdata of the new time period from the back end after the user clicks the dates switch button .But the dateRangeChange trigger twice when I initialized the data through "calendar.project.loadInlineData()" .

 this.calendar.project.loadInlineData({
        eventsData:totalData,
        resourcesData:this.resourceGroup
      })

I think it should only be triggered once,but not.

Moreover, when I switch modes, “dateRangeChange” will be triggered twice agian.
What I expect is that “dateRangeChange” will only be triggered when the user clicks the dates switch button.
Is there something wrong, or is there a problem with my logic?


Post by Animal »

When you switch modes, the date range that is required to show the events in the UI changes.

For example from one week to one month. A new range of dates is needed.

So you react to that and do loadInlineData.

Loading data triggers a UI refresh.

A UI refresh requests a block of events from the store for the range it covers. If the range requested is different from last time, the event will be triggered again.

Are the date ranges the same? I would think they would be, but maybe not.

Because the EventStore has checks to not fire the event if the same date range has been requested:

        const
            newDateRange    = {
                startDate,
                endDate
            },
            dateRangeChange = !lastDateRange || (lastDateRange.startDate - newDateRange.startDate || lastDateRange.endDate - newDateRange.endDate);

        if (dateRangeChange) {
            // Ensure the listeners are present
            me.processConfiguredListeners();

            /**
             * Fired when a range of events is requested from the {@link #function-getEvents} method.
             * @event loadDateRange
             * @param {Scheduler.data.EventStore} source This EventStore
             * @param {Object} old The old date range
             * @param {Date} old.startDate the old start date.
             * @param {Date} old.endDate the old end date.
             * @param {Object} new The new date range
             * @param {Date} new.startDate the new start date.
             * @param {Date} new.endDate the new end date.
             */
            me.trigger('loadDateRange', {
                old : lastDateRange || {},
                new : Object.assign({}, newDateRange)
            });
            me.lastDateRange = newDateRange;
        }

Post by lanpeng »

Hi Animal.
I can understand what you said, but the problem I'm facing now is that the "dateRangeChange" trigger twice after project.loadInlineData . In the p1,You can see that when the "dateRangechange"is triggered for the second time, the StartDate and endDate of new become the starting point of the timestamp in 1970.

when i switch mode ,the "dateRangeChange" triggered twice again . What puzzles me more is that The old and new of the parameters of them are exactly the opposite. As shown in p2

Attachments
p2.png
p2.png (131.66 KiB) Viewed 835 times
p1
p1
p1.png (109.29 KiB) Viewed 835 times

Post by Animal »

There seems to be some bugs. I'm investigating.


Post by Animal »

Here is the ticket. It will be fixed in the next release: https://github.com/bryntum/support/issues/3672


Post by lanpeng »

Hi bryntum team.
Can you tell me when the new version(4.3.3) will be released?? Our project is about to go online. If possible, I hope you will release new version as soon as possible . thanks


Post by mats »

We aim to release next version Monday / Tuesday next week. You can always download a nightly build which typically are very very stable.


Post by lanpeng »

Hi ,
Will you release new version next week ?


Post by alex.l »

Hi lanpeng,

Yes, we plan to release 4.3.3 on Wednesday.

All the best,
Alex


Post Reply