ExtJS:如何将标签绑定到具有单个记录的 ViewModel 存储
ExtJS: How do I bind a label to a ViewModel store with a Single record
请看以下内容Fiddle:Bind store from a ViewModel to an xtype label
我无法从我的 ViewModel 存储中获取记录以显示在我表单的 xtype: 'label'
项中。
这应该很容易,可惜我脑子不行了...
无法为商店的第一条记录创建绑定描述符。为此,您需要实施 formula。
在您的视图模型中:
formulas: {
firstTestStoreRecord: {
bind: '{testStore}',
get: function(testStore) {
return testStore.getAt(0);
}
}
}
然后在您的视图中使用它:
bind: {
html: '<b>{firstTestStoreRecord.test}</b>'
}
这是工作 fiddle:https://fiddle.sencha.com/#fiddle/25cf&view/editor
在版本 7.4 中:
bind: {
html: '<b>{testStore.first.test}</b>'
}
请看以下内容Fiddle:Bind store from a ViewModel to an xtype label
我无法从我的 ViewModel 存储中获取记录以显示在我表单的 xtype: 'label'
项中。
这应该很容易,可惜我脑子不行了...
无法为商店的第一条记录创建绑定描述符。为此,您需要实施 formula。
在您的视图模型中:
formulas: {
firstTestStoreRecord: {
bind: '{testStore}',
get: function(testStore) {
return testStore.getAt(0);
}
}
}
然后在您的视图中使用它:
bind: {
html: '<b>{firstTestStoreRecord.test}</b>'
}
这是工作 fiddle:https://fiddle.sencha.com/#fiddle/25cf&view/editor
在版本 7.4 中:
bind: {
html: '<b>{testStore.first.test}</b>'
}