Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs向模型添加列_Extjs - Fatal编程技术网

Extjs向模型添加列

Extjs向模型添加列,extjs,Extjs,在我的extjs列模型中,我有: new Ext.grid.ColumnModel({ columns: [ {id:'msgId',hidden: false, dataIndex: 'msgId'} ] 现在,我希望向模型中添加另一列,该列将是一个超链接,带有文本:“查看消息详细信息”,单击时应调用javascript函数fnMessageDetails('msgId') 如何将此列添加到模型中?我可以添加一个没有dataIndex属性的列吗 我可以添加

在我的extjs列模型中,我有:

new Ext.grid.ColumnModel({
columns: [
{id:'msgId',hidden: false, dataIndex: 'msgId'}                  
]
现在,我希望向模型中添加另一列,该列将是一个超链接,带有文本:“查看消息详细信息”,单击时应调用javascript函数fnMessageDetails('msgId')

如何将此列添加到模型中?我可以添加一个没有
dataIndex
属性的列吗

我可以添加没有dataIndex属性的列吗

是的,如果您使用自己的渲染器或templatecolumn也可以

如何将此列添加到模型中

您可以使用
渲染器
配置或
模板列
。例如:

new Ext.grid.ColumnModel({
  columns: [
    {id:'msgId',hidden: false, dataIndex: 'msgId'},
    {
        header: 'info',
        xtype: 'templatecolumn',
        tpl: '<a href="#">View Message Details</a>',
        listeners: {
            click: function(col, grid, row){
                fnMessageDetails(grid.store.getAt(row).get('msgId'));
                return false;
            }
        }
    } 
  ]
});
新建Ext.grid.ColumnModel({
栏目:[
{id:'msgId',hidden:false,dataIndex:'msgId'},
{
标题:“信息”,
xtype:'templatecolumn',
第三方物流:,
听众:{
单击:函数(列、网格、行){
fnMessageDetails(grid.store.getAt(row.get('msgId'));
返回false;
}
}
} 
]
});

这是

是否要动态添加它?