ExtJS:如何使用单个记录将标签绑定到ViewModel存储

ExtJS:如何使用单个记录将标签绑定到ViewModel存储,extjs,data-binding,viewmodel,Extjs,Data Binding,Viewmodel,请看下面的小提琴: 我无法从ViewModel的存储中获取记录以显示在表单的xtype:“label”项中 这应该很容易,但可惜我的大脑无法工作…没有办法为存储的第一条记录创建绑定描述符。为此,您需要实现一个 在视图模型中: formulas: { firstTestStoreRecord: { bind: '{testStore}', get: function(testStore) { return testStore.getA

请看下面的小提琴:

我无法从ViewModel的存储中获取记录以显示在表单的
xtype:“label”
项中


这应该很容易,但可惜我的大脑无法工作…

没有办法为存储的第一条记录创建绑定描述符。为此,您需要实现一个

在视图模型中:

formulas: {
    firstTestStoreRecord: {
        bind: '{testStore}',
        get: function(testStore) {
            return testStore.getAt(0);
        }
    }
}
然后在您的视图中使用此选项:

bind: {
    html: '<b>{firstTestStoreRecord.test}</b>'
}
bind:{
html:“{firstTestStoreRecord.test}”
}

这是一个可行的办法:

无法为存储的第一条记录创建绑定描述符。为此,您需要实现一个

在视图模型中:

formulas: {
    firstTestStoreRecord: {
        bind: '{testStore}',
        get: function(testStore) {
            return testStore.getAt(0);
        }
    }
}
然后在您的视图中使用此选项:

bind: {
    html: '<b>{firstTestStoreRecord.test}</b>'
}
bind:{
html:“{firstTestStoreRecord.test}”
}

这是工作小提琴:

工作得很有魅力@scebotari66“无法为存储区的第一条记录创建绑定描述符”仅供参考,从6.5开始这不再是事实:@Evantimboli我不知道这一点。谢谢你的提示!您可以绑定到first/last/count/totalCount。您还可以绑定到新添加到6.5的模型dirty/phantom/valid。工作起来很有魅力@scebotari66“无法为存储区的第一条记录创建绑定描述符”仅供参考,从6.5开始这不再是事实:@Evantimboli我不知道这一点。谢谢你的提示!您可以绑定到first/last/count/totalCount。您还可以绑定到新添加到6.5的模型dirty/phantom/valid。