如何在Extjs中动态设置xtype gridcolumn的dataIndex值
How to dynamically set the value of dataIndex for xtype gridcolumn in Extjs
我想根据数据的可用性动态设置网格列的dataIndex值。我的代码如下:
型号:
{
name: 'idCcyAcc',
mapping: 'order.idCcyCreditAcc'
},
{
name: 'idCcyFullAcc',
mapping: 'order.idCcyCreditFullAcc'
},
视图:
{
xtype: 'gridcolumn',
filter: {
xtype: 'textfield'
},
filterable: true,
dataIndex: 'idCcyCreditAcc',
text: 'Credit Account Currency',
id: 'paymentPanelGridCrAccCcy',
width: 150,
renderer: Ext.bind(this.onRenderCell, this)
},
我如何根据dataType(即)动态设置dataIndex的值
if(type=Internal){
dataIndex: 'idCcyCreditAcc'
} else {
dataIndex: 'idCcyCreditFullAcc'
}
感谢您的帮助。
我在模型中做了以下操作,达到了目的:
{
name: 'idCcyAcc',
convert: function(value, record){
if(record.data.idProductType == 'Internal') {
return record.data.idCcyCreditFullAcc;
} else {
return value;
}
},
mapping: 'order.idCcyCreditAcc'
},
相关文章:
- ExtJS xtype timefield - 设置默认选定
- 如何在一个页面中集成多个小部件(xtype)
- EXTJS 4.2 为行实现多个编辑器 xtype 编辑网格
- Extjs 4.2.1 - 从xtype网格拖放到xtype容器
- ExtJS xtype正在注册
- Ext.grid.Panel xtype ExtJs 4
- 如何在Extjs中动态设置xtype gridcolumn的dataIndex值
- 是否可以在ExtJS模板中使用xtype ?
- xtype和itemId属性在自定义ExtJS组件中丢失
- ExtJs(4.2.0)带有xtype:按钮列的可编辑网格
- 我如何改变Xtype属性的设备Android &iOS
- ExtJS Forms >.getFieldValues()函数没有返回“时间字段”的任何值;xtype
- 控制器上缺少xtype / alias,在refs中使用
- 试图创建一个未注册的xtype组件:
- 这是什么ext.js's ' xtype: 'app-main'
- 格式日期&在kendo.ui.GridColumn
- Sencha xtype导航在添加initialize函数时失败
- 在 ExtJS 4 中创建具有 xtype 的扩展
- 如何使用style属性为Ext js的xtype表面板应用样式
- ExtJS xtype菜单在Chrome中超时