Ext中gridpanel每行后面可编辑、删除,使用actioncolumn

本文介绍如何使用ExtJS中的ActionColumn配置项为Grid添加操作按钮,包括编辑和删除功能,并展示了如何通过点击图标触发相应的事件处理函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如下代码:

var ac = {
xtype: 'actioncolumn',
header: '操作',
width: 50,
items: [{
icon : basePath + '/resources/images/edit.gif', // Use a URL in the icon config
tooltip: '编辑',
handler: function(grid, rowIndex, colIndex) {
var store = Ext.getCmp("mygrid").getStore();
var value = store.getAt(rowIndex);
initStore(storeDept);

//获取编辑window窗口
var windowedit = Ext.getCmp("windowedit");
if(!Ext.value(windowedit)){
editFun(storeDept, value, "");
}
}
},{
icon : basePath + '/resources/images/remove.png', // Use a URL in the icon config
tooltip: '删除',
handler: function(grid, rowIndex, colIndex) {
Ext.MessageBox.confirm("确认",'是否确认删除?',function(btn){
if('yes' == btn){
var store = Ext.getCmp("mygrid").getStore();
var value = store.getAt(rowIndex);
var departmentId = value.get('departmentId');
deleteFun(departmentId);
}
});
}
}
]
};

创建好actioncolumn对象之后,把它添加到columnModel数组中去,即可实现,都试试吧
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值