我創建了一個Ext.grid.GridPanel。我正在嘗試將列號xtype: button
添加到列模型中。我不確定,如果我能做到這一點。下面是我的代碼,也這是的jsfiddle http://jsfiddle.net/bXUtQ/將Ext.Button添加到ExtJS columnmodel
我使用ExtJS的3.4
Ext.onReady(function() {
var myData = [[ 'Lisa', "[email protected]", "555-111-1224"],
[ 'Bart', "[email protected]", "555-222-1234"],
[ 'Homer', "[email protected]", "555-222-1244"],
[ 'Marge', "[email protected]", "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
})
});
});
您使用的是'actioncolumn'爲您刪除「按鈕」。爲什麼不把它用於你的提交按鈕呢? – A1rPun 2013-03-13 15:58:31
actioncolumn用於測試xtype。謝謝。 – user2073131 2013-03-13 16:08:05