Premium support for our pure JavaScript UI components


Post by tikhonov.a.p »

Tell me how to change the ProjectModel class or extend it?

In some forum articles, I see that projectModelClass is passed to the Gantt configuration

viewtopic.php?f=52&t=19490&p=96414&hilit=ProjectModelClass#p96414
viewtopic.php?f=52&t=20227&p=100384&hilit=ProjectModelClass#p100384

However, if I try to do something similar

nothing comes out

const ganttConfig: BryntumGanttProps = {
    project: {
        autoLoad: true,
        taskModelClass: TaskExtModel,
        taskStore: TaskExtStore,
        transport: {
            load: {
                url: 'data/launch-saas.json'
            }
        },
        // This config enables response validation and dumping of found errors to the browser console.
        // It's meant to be used as a development stage helper only so please set it to false for production systems.
        validateResponse : true
    },

//@ts-ignore
projectModelClass : ProjectModelExtended,
columns: [{ type: 'name', field: 'name', width: 250 }],
viewPreset: 'weekAndDayLetter',
barMargin: 10
};

export { ganttConfig };

typescript also swears that there is no such parameter at all
Ver: 5.1.X


Post by marcio »

Hey tikhonov.a.p,

You can check here https://www.bryntum.com/docs/gantt/guide/Gantt/data/project_data#adding-custom-fields-to-entities how you can extend ProjectModel class.

You need to define a new class that extends the ProjectModel class, with your customization. After that setup, you will be able to add that there.

Also, it seems that this property is missing from TS typing, so I created a ticket to add it https://github.com/bryntum/support/issues/4996

Thanks for the report

Best regards,
Márcio


Post by tikhonov.a.p »

When I wrote the ticket, I made a class inherited from the ProjectModel, and entered it in this way into the configuration. However, the added method did not appear in gantt.project

However, the same thing worked for TaskModel


Post by tikhonov.a.p »

Any news?


Post by marcio »

Could you please share a sample project with how did you set up the classes?? With that, we could help you better fix this.

Best regards,
Márcio


Post by tikhonov.a.p »

In the console, you can type gantt.projectModelClass
Or try call gantt.project.testAsd()

Attachments
basic.zip
(2.19 MiB) Downloaded 38 times

Post by tikhonov.a.p »

Any news?


Post by alex.l »

Since this config is not public and not documented at the moment, wrappers are not supported that as well.
It becomes to be available when we make this config public.
Thank you for your question.

All the best,
Alex


Post by tikhonov.a.p »

An interesting point, recommend to use, but do not support the recommendation. Things happen


Post by alex.l »

Yes, it has been recommended as a part of Engine overrides that users required. That's true, I don't see we mentioned that it's private now, even if it's not available in docs.
It works well in Vanilla products but, as all others private methods and configs, are not available on wrappers. Wrappers generate automatically using scripts and include only public API to interact.

All the best,
Alex


Post Reply