Our pure JavaScript Scheduler component


Post by [email protected] »

Hello,
I am trying to upgrade to version 8 and it's mostly going well. With minimal code changes I was able to make a Calendar (yearplanner view) and a Scheduler work correctly.
Another scheduler, however, which uses cell tooltips is holding me back. I cannot replicate the problem on any of the demos and to provide a copy of the code in question is a bit difficult. Nonetheless, I was hoping you could point me in the right direction after I give some context.

First of all, the code works well in version 7.3.8. This is happening in a Laravel application with the Bryntum components running in JavaScript, which, in turn, is bundled by Vite.

Now, a small section of the code that throws the error:

import { Scheduler, ResourceStore } from '@bryntum/scheduler-enterprise';

import {
    DomHelper,
    Fullscreen,
    Toast,
    Localizable,
    MessageDialog
} from '@bryntum/core-enterprise';

export class SchedulerBase {
	scheduler;
	
buildConfig({ container, token }) {
    let startDate = container.dataset.startDate;
    let endDate = container.dataset.endDate;
    return {
        appendTo: container,
        startDate,
        endDate,
        infiniteScroll: false,
        ...
        columns: [
            {
                type: 'tree',
                text: 'L{Words.offices}',
                field: 'name',
                width: 120,
                minWidth: 120,
                align: 'left',
                editor: false,
                locked: true,
                sortable: false,
                htmlEncode: false,
                showEventCount: true,
                renderer : ({ record }) => getResourceNameContent(record)
            },
            {
                width: 35,
                minWidth: 35,
                align: 'left',
                editor: false,
                locked: true,
                sortable: false,
                htmlEncode: false,
                renderer: ({record}) => getResourceTypeIcon(record)
            },
            {
                width: 35,
                minWidth: 35,
                align: 'left',
                editor: false,
                locked: true,
                sortable: false,
                htmlEncode: false,
                renderer: ({record}) => getResourceFeaturesIcons(record)
            }
        ],
        features: {
            timeAxisHeaderMenu: false,
            tree: { allowDropOnParent: false },
            ...
            eventTooltip: {
                hoverDelay: 500,
                template: data => getEventTooltipContent(data.eventRecord)
            },
            cellTooltip : {
                hoverDelay: 500,
                ui: 'plain',
                tooltipRenderer: ({ record }) => getResourceTooltipContent(record)
            }
        },
        tbar: {
            items: {
                initialDates: {
                    type: 'daterangefield',
                    editable: false,
                    value: [new Date(startDate), new Date(endDate)],
                    autoExpand: true,
                    format: 'D MMMM YYYY',
                    onChange: (value) => this.setDatesAndReload(value)
                },

                spacer: '->',
                ....
   };
   
   this.scheduler = new Scheduler(this.buildConfig({container, token}));
}

Am I missing some imports? I am not sure how to resolve this and the AI assistant in the documentation cannot provide an explanation given that "the configuration I am using is correct in principle".

The full error is below:

Uncaught (in promise) Error: Invalid type name "cellTooltip" passed to IT factory
    at IT.resolveType (SchedulerDatePicker-gzbKTsfn.js:1208:120744)
    at IT.reconfigure (SchedulerDatePicker-gzbKTsfn.js:1208:120182)
    at Vf.set (SchedulerDatePicker-gzbKTsfn.js:1211:45368)
    at Vf.get (SchedulerDatePicker-gzbKTsfn.js:1211:45173)
    at Object.get (SchedulerDatePicker-gzbKTsfn.js:1211:44419)
    at Object.values (<anonymous>)
    at ei.setGridClassList (SchedulerDatePicker-gzbKTsfn.js:1345:86120)
    at ei.finishConfigure (SchedulerDatePicker-gzbKTsfn.js:1345:84726)
    at ei.setConfig (SchedulerDatePicker-gzbKTsfn.js:1205:18747)
    at ei.configure (SchedulerDatePicker-gzbKTsfn.js:1205:17902)

If you need more information to suggest anything please let me know.

Many thanks.


Post by ahmadzaheer »

Hello,

Your config is fine, you're just missing one import.

In version 8 each npm package only loads its own classes. cellTooltip is a Grid feature that Scheduler doesn't use internally, so it isn't registered when you import only from the Scheduler and Core packages. In 7.3.8 everything shipped in one bundle, which is why it worked there.

Add this once, anywhere before the Scheduler is created:

import '@bryntum/grid-enterprise';

The package is already installed as a dependency of @bryntum/scheduler-enterprise.

More details in the upgrade guide:
https://bryntum.com/docs/guide/Scheduler/upgrades/8.0.0#npm-package-names-now-include-the-tier

Let us know if it still doesn't work after adding the import.

Regards,
Ahmad Zaheer


Post by [email protected] »

Apologies, I got the general message about adding the tier, but I completely missed the very explicit part describing the exact problem I was having.
Adding the import resolved the issue. Thank you very much.


Post Reply