Is it possible to share one view between two models? I have a panel with many identical components. Each of them has three numberField controls (new value, current and past), its own controller and viewmodel. But I also have a parent model. Can I use standard extjs tools to bind two models (parent and child) with different property names to one control?
// view pseudocode
{
xtype: 'panel',
controller: 'parentController',
viewModel:{
id: 'parent',
type: 'parent'
},
items:[{
xtype: 'panel',
controller: 'childController',
viewModel:{
id: 'child_1',
type: 'child'
},
items:[{
xtype: 'numberfield',
minValue: 0,
bind: '{child_1}',
},{
xtype: 'numberfield',
minValue: 0,
bind: '{child_2}',
}]
}]
}
// parent viewModel pseudocode
{
data: {
child_1_1: 0,
child_1_2: 0
}
}
// child viewModel pseudocode
{
data: {
child_1: 0,
child_2: 0
}
}
// need child_1_1 <-> child_1 and child_1_2 <-> child_2
I want something similar to this. I would like to be able to both assign and read both models and get the same values, as well as declaratively bind methods to value change events.