Page 1 of 2

[REACT] ProjectModelClass

Posted: Mon Aug 01, 2022 3:00 pm
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


Re: [REACT] ProjectModelClass

Posted: Mon Aug 01, 2022 3:43 pm
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


Re: [REACT] ProjectModelClass

Posted: Tue Aug 02, 2022 8:23 am
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


Re: [REACT] ProjectModelClass

Posted: Tue Aug 02, 2022 3:26 pm
by tikhonov.a.p

Any news?


Re: [REACT] ProjectModelClass

Posted: Tue Aug 02, 2022 8:55 pm
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.


Re: [REACT] ProjectModelClass

Posted: Wed Aug 03, 2022 8:29 am
by tikhonov.a.p

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


Re: [REACT] ProjectModelClass

Posted: Wed Aug 03, 2022 2:39 pm
by tikhonov.a.p

Any news?


Re: [REACT] ProjectModelClass

Posted: Thu Aug 04, 2022 2:31 pm
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.


Re: [REACT] ProjectModelClass

Posted: Thu Aug 04, 2022 4:11 pm
by tikhonov.a.p

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


Re: [REACT] ProjectModelClass

Posted: Thu Aug 04, 2022 4:18 pm
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.