extjs嵌套数据未显示在数据绑定网格中
如何使用我从webapi ef创建的以下格式将extjs6网格数据绑定到包含“佣金”的网格中 网格列应该如下所示extjs嵌套数据未显示在数据绑定网格中,extjs,data-binding,grid,Extjs,Data Binding,Grid,如何使用我从webapi ef创建的以下格式将extjs6网格数据绑定到包含“佣金”的网格中 网格列应该如下所示 title: 'Commissions', xtype: 'grid', bind: { store: '{myAccountDetails.commission}' }, ui: 'featuredpanel-framed', cls: 'custom-grid', margin: '0 0 0 0', itemId: 'gridCommId', collapsible: true
title: 'Commissions',
xtype: 'grid',
bind: {
store: '{myAccountDetails.commission}'
},
ui: 'featuredpanel-framed',
cls: 'custom-grid',
margin: '0 0 0 0',
itemId: 'gridCommId',
collapsible: true,
columns: [
{
header: 'USD',
dataIndex: 'usd',
flex: 1
},
{
header: 'AUD',
dataIndex: 'aud',
flex: 1
},
{
header: 'CAD',
dataIndex: 'cad',
flex: 1
}
这是我对网格的看法
我附上的截图是myAccountDetails
任何帮助都将不胜感激
只是一个旁注。。。如果我添加一个标签,我可以返回我正在寻找的信息,但我希望它在一个网格内
xtype: 'label',
cls: 'myLabelCRM2',
bind: {
text: '{myAccountDetails.commission.aud}'
}
最好的方法是在viewmodel中定义一个存储,并使用mustache语法将其数据字段直接绑定到details Commission字段
Ext.define('MyView', {
viewModel: {
data: {
myAccountDetails: {
accountName: 'foo',
commision: {
aud: 7,
cad: 8,
usd: 9
}
}
},
stores: {
commisionStore: {
fields: ['aud', 'cad', 'usd'],
data: '{myAccountDetails.commision}'
}
}
},
extend: 'Ext.grid.Panel',
xtype: 'MyView',
bind: {
store: '{commisionStore}'
},
columns: [{
header: 'USD',
dataIndex: 'usd',
flex: 1
}, {
header: 'AUD',
dataIndex: 'aud',
flex: 1
}, {
header: 'CAD',
dataIndex: 'cad',
flex: 1
}]
});
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create({
xtype: 'MyView',
width: 300,
height: 300,
renderTo: Ext.getBody()
});
}
});
什么是
myAccountDetails
?商店?vm中的数据字段?抱歉,是的,确切地说,myAccountDetails是视图模型中的数据字段谢谢。。。在您创建的commissionStore中,如何用已创建的模型替换您使用的字段?模型:'full.model.Name'。虽然就个人而言,我不认为模型是有用的,除非你想使用联想功能。。。你的例子解决了我的问题!由于某种原因,当我放置模型时,网格是空的,但是如果我移除模型,它会完美地工作。不知道为什么。谢谢你的帮助