Our pure JavaScript Scheduler component


Post by striker »

Hello.

I am using full version of SchedulerPro & Gantt.
Version: 4.1.1

package.json

    "@bryntum/gantt": "4.1.1",
    "@bryntum/schedulerpro": "4.1.1",
    // ...
    "@angular/core": "11.2.11",
 

I am rendering SchedulerPro by creating instance and appendTo:

        const schedulerInstance = new SchedulerPro({
          appendTo: this.schedulerDiv.nativeElement,
          columns: [
            {
              type: 'resourceInfo',
              field: 'name',
              text: resourceColumnName,
              minWidth: 200,
              showEventCount: true,
              showImage: true, 
              showRole: true,
              htmlEncode: false,
              renderer: (cellInfo: any) => {
                    //...
              }
            }
          ],
          features: {
            eventEdit: false,
            percentBar: false, 
            taskEdit: false,
            resourceTimeRanges: true
          },
          rowHeight: 50,
          readOnly: true,
        });

    this.schedulerInstance = schedulerInstance;

And while resourceTimeRanges feature is enabled, Scheduler is not rendering propertly with error in the console:

TypeError: Cannot set property resourceTimeRangeStore of [object Object] which has only a getter
    at SchedulerPro.updateProject (gantt.module.js:130725)
    at SchedulerPro.updateProject (gantt.module.js:151929)
    at SchedulerPro.set (gantt.module.js:1881)
    at SafeSubscriber.ganttService.getGanttForResources.subscribe.schedulerInstance.project [as _next] (gantt-chart.component.ts:191)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:183)
    at SafeSubscriber.next (Subscriber.js:122)
    at Subscriber._next (Subscriber.js:72)
    at Subscriber.next (Subscriber.js:49)
    at MapSubscriber._next (map.js:35)
    at MapSubscriber.next (Subscriber.js:49)
 

I found similar problem on your git repo:
https://github.com/bryntum/support/issues/2521

I wrote there comment with another example.
I tried to creating own store, but it didn't resolve my problem.

Can you provide me a solution?

Greetings.


Post by mats »

Seems to work fine for me in latest code, 4.1.2 is on the way out so please try grabbing it (few hours at most) to confirm?


Post by striker »

Sure, I can wait.
I will reply after release 4.1.2 version.


Post by striker »

I just update version from 4.1.1 to 4.12

package.json

"@bryntum/gantt": "4.1.2",
"@bryntum/schedulerpro": "4.1.1",
err.png
err.png (64.06 KiB) Viewed 1440 times

Same error.

I am importing SchedulerPro from

import { LocaleManager, PresetManager, ProjectModel, SchedulerPro } from '@bryntum/gantt';

Post by alex.l »

Hi striker,

Could you please attach a runnable test case or try to reproduce it with our examples because it is not reproducible on our side?

All the best,
Alex

All the best,
Alex


Post by alex.l »

Hi striker,

I was able to reproduce the problem with a bit different approach. The issue is still there, we will fix it.

Thank you for the report!
Alex

All the best,
Alex


Post by striker »

Can you tell what was the problem? I mean, what I have configured that it's not working in my project.

Greetings.


Post by alex.l »

I found that it works with problems only if resourceTimeRangeStore has been set after the scheduler has been initialized, dynamically (see bug description in the ticket). If you have this error for your static configuration, I would suggest you to test it once again with our examples, make sure you updated all sources correctly and if you still have it, attach your app here, we will try to help you out.

All the best,
Alex


Post by striker »

I checked again with looking async functions.
Error is occuring If I set project model programatically.

Steps:
1) Rendering Gantt.
2) Getting resources data from API.
3) Setting ProjectModel programatically (after 300ms)

this.schedulerInstance.project = project

Post by striker »

Update:
I edited my solution - getting resources first, then rendering gantt. It seems to work!


Post Reply