Changing the default values of a model.Component is still too difficult.
Example: The calendar is using a MainContainerModel which has a currentDate data prop. In case we want to change the value of it, we have to create a config with the same name on the MainContainer and then use a two way binding.
In case we want to use the calendar.weekview.MainContainer as a standalone widget, we need to use the MainContainerModel to make it work. In this case, all relevant model data props would need configs and two way bindings as well. Way too much boiler plate code!
To resolve this, it would be nice to specify data we want to change like this:
model: {
module: MainContainerModel,
data : {
currentDate: new Date('2021-07-20')
}
}
We want to change the values for specific (nested) data props without removing the other props we defined on class level. To do this, we need to use the mergeConfig() logic and deep merge the class based data with the instance config data.
In case we extend or use classes which already have a view model, we don't want to import the specific model base class for data changes again, so component.Base needs a modelData config to resolve this.
Example inside a container items array:
{
module : Calendar,
flex : 1,
reference: 'calendar',
calendarStoreConfig: {
autoLoad: true,
url : '../../examples/calendar/basic/data/calendars.json'
},
eventStoreConfig: {
autoLoad: true,
url : '../../examples/calendar/basic/data/events.json'
},
modelData: {
currentDate: new Date('2021-07-20')
}
}
Changing the default values of a
model.Componentis still too difficult.Example: The calendar is using a
MainContainerModelwhich has acurrentDatedata prop. In case we want to change the value of it, we have to create a config with the same name on theMainContainerand then use a two way binding.In case we want to use the
calendar.weekview.MainContaineras a standalone widget, we need to use theMainContainerModelto make it work. In this case, all relevant model data props would need configs and two way bindings as well. Way too much boiler plate code!To resolve this, it would be nice to specify data we want to change like this:
model: { module: MainContainerModel, data : { currentDate: new Date('2021-07-20') } }We want to change the values for specific (nested) data props without removing the other props we defined on class level. To do this, we need to use the
mergeConfig()logic and deep merge the class based data with the instance config data.In case we extend or use classes which already have a view model, we don't want to import the specific model base class for data changes again, so
component.Baseneeds amodelDataconfig to resolve this.Example inside a container items array:
{ module : Calendar, flex : 1, reference: 'calendar', calendarStoreConfig: { autoLoad: true, url : '../../examples/calendar/basic/data/calendars.json' }, eventStoreConfig: { autoLoad: true, url : '../../examples/calendar/basic/data/events.json' }, modelData: { currentDate: new Date('2021-07-20') } }