我正在创建一个 Ext.grid.GridPanel。我正在尝试将带有 xtype: button
的列添加到列模型中。我不确定,如果我能做到这一点。下面是我的代码,也是 jsfiddle http://jsfiddle.net/bXUtQ/ 的链接
我正在使用 extjs 3.4
Ext.onReady(function () {
var myData = [[ 'Lisa', "lisa@simpsons.com", "555-111-1224"],
[ 'Bart', "bart@simpsons.com", "555-222-1234"],
[ 'Homer', "home@simpsons.com", "555-222-1244"],
[ 'Marge', "marge@simpsons.com", "555-222-1254"]];
var store = new Ext.data.ArrayStore({
fields:[ {
name: 'name'
},
{
name: 'email'
},
{
name: 'phone'
}],
data: myData
});
var grid = new Ext.grid.GridPanel({
renderTo: 'grid-container',
columns:[ {
header: 'Name',
dataIndex: 'name'
},
{
header: 'Email',
dataIndex: 'email'
},
{
header: 'Phone',
dataIndex: 'phone'
},
{
header: 'action',
xtype: 'actioncolumn',
iconCls: 'delete-icon'
text: 'Delete',
name: 'deleteBtn',
handler: function(grid, rowIndex, colIndex, item, e) {
alert('deleted');
}
},
//////////////////////////////
//I cannot add this column
{
header: 'action',
xtype: 'button',
text: 'update',
name: 'btnSubmit'
}
],
store: store,
frame: true,
height: 240,
width: 500,
title: 'Framed with Row Selection',
iconCls: 'icon-grid',
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});
});
最佳答案
您不能像那样将按钮用作列。我们正在使用以下 UX 来实现您的要求。不幸的是,这是针对 ExtJS 4.1 的:
http://www.sencha.com/forum/showthread.php?148064-Component-Column-Components-in-Grid-Cells
关于extjs - 将 Ext.Button 添加到 ExtJS columnmodel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15389739/