Premium support for our pure JavaScript UI components


Post by aarshev »

Hello Bryntum dev team,

I am writing to you regarding an issue which occurred while using the Scheduler Pro product.

Error details

The error we get is:

 ObjectName: Resources
 Event: onReady 
 HandlerType: userDefined  
 TypeError: Cannot read property 'getEvents' of undefined

In the next lines I will explain how I reproduce the error.

Reproducing the error
When I create the Scheduler Pro project, I create empty stores for the data.

const scheduler = new bryntum.schedulerpro.SchedulerPro({ 

appendTo: 'schedulerpro-container', 

project: { 

resourceStore: { 

        useRawData: true, 

        data: [] 

} 

} 

}) 

After that on the onReady event (when our data from the server is loaded), I assign our data to the store in the required format.

var dataListResources = [] 

dataListResources.push({"id": 1,  "name": “John Doe”}, {"id": 2,  "name": “Jane Doe”} ) 

scheduler.store.data = dataListResources 

Respectevly the othe stores:

// Events 
scheduler.events = dataListEvents 
//Assignments 
scheduler.assignments = dataListAssignments 

On the initial load everything works as expected. The problem appears after I change the data in my dataset. The required behavior is to dynamically update the visualization of the project. Instead of that I get the error described in the “Error details” section.

Everything was working as expected while I was on the Scheduler component. The issue appeared when I migrated from Scheduler to Scheduler Pro.

Can you please clarify why the error is occurring in the Scheduler Pro tool. Am I missing something?

Best Regards,
Aarshev


Post by pmiklashevich »

It's not enough info in your report. Please always attach full error message and a runnable testcase that shows the issue. See the guidelines: viewtopic.php?f=35&t=772

Nevertheless it is very similar to this issue: https://github.com/bryntum/support/issues/2088

Just for the test purpose you can update the code and try conditional calculation:

            count        = record.eventStore?.getEvents({
                includeOccurrences : scheduler.enableRecurringEvents,
                resourceRecord     : record,
                startDate          : timeAxis.startDate,
                endDate            : timeAxis.endDate
            }).length || 0,

Please subscribe to the ticket to get notified when it's done.

Cheers!

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply