Ext.js 在 grid中加入按钮,复制粘贴可用

版本: Ext.js 3.4
效果图:
Ext.js 在 grid中加入按钮后效果
代码如下:


var q_GPanel_to_call_list = new Ext.grid.EditorGridPanel({
	store : q_dstore_todo, // TODO: 你自己的store
	width :  '100%',
	height : 260,
	clicksToEdit: 1,  // 设置点击一次修改
	stripeRows : true,
	frame: true, // 有边框
	//autoHeight : true,
	autoFill:true,
	autoScroll:true,

  //下方的工具栏
	bbar : new Ext.PagingToolbar({
		store : q_dstore_todo,// TODO: 你自己的store
		pageSize : 10,
		displayInfo : true,
		displayMsg : '待处理 {0} - {1} of {2}',// 右下角显示第几个
		emptyMsg : ' TODO 你自己的信息',
		listeners : {
			"beforechange" : function(toolbar, page) {
				q_dstore_todo.reload({
					params : {
						cmd : 'q_dstore_todoReload'// TODO: 你自己的 reload 功能
					},
					callback : function() {
						if (q_dstore_todo.getCount() > 0) {
							document.getElementById('q_dstore_todo_get_infos').innerHTML = '<font color="red">查询成功!</font>';
						} else {
							document.getElementById('q_dstore_todo_get_infos').innerHTML = '<font color="red">无待处理账号!</font>';
						}
					}
				});
			}
		}
	}),
	columns : [ // 此处为了简短删除了大部分columns
			{
				id : 'q_dstore_todo',
				header : '号码/账号',
				sortable : true,
				renderer : ifNull,
				width : 80,
				dataIndex : 'q_dstore_todo_fields1' //dataIndex 要在 q_dstore_todo 的fields中 相同才能绑定
			},{
				id : 'q_gp_to_verify_remark',
			    xtype: 'actioncolumn',
				header : '验证备注',
				sortable : true,
				editor : new Ext.form.TextField(),
				renderer : ifNull,
				width : 120,
				dataIndex : 'q_dstore_todo_fields1'
			},
      // 按钮的实现 !!!!!! 重点!!!!!!!记得看最后的备注 !!!
      // 修改图片路径后可直接复制粘贴使用 
			{
	            xtype:'actioncolumn',
	            width:50,
				header : '合规',
	            items: [{
	                icon: 'images/icons/yes_right_16px.png',  // TODO: 你自己的图片, 注意目前必须加图片,用图片代替按钮
	                tooltip: ' 合规 ',
                  // TODO :你自己的功能
	                handler: function(grid, rowIndex, colIndex) {
	                    var rec = grid.getStore().getAt(rowIndex);

	                    alert("合规 " + rec.get('accs_nbr'));
	                }
	            }]},
        //也可以把下面不合规的 items中的 {...} 元素,放到上面,这样会出现在一个column中
 				{
		            xtype:'actioncolumn',
		            width:50,
					header : '不合规',
		            items: [
		            	   {
		   	                icon: 'images/icons/wrong_15px.png',
		   	                tooltip: '不合规 ',
		   	                handler: function(grid, rowIndex, colIndex) {
		   	                    var rec = grid.getStore().getAt(rowIndex);
		   	                    alert("不合规 " + rec.get('accs_nbr'));
		   	                }
		            }]}
			]
});

  1. 要自己修改的内容, 我都用 todo 标注了。
  2. 想要直接复制粘贴使用的话,需要手动修改两个图片的路径. 然后就可以自己修改function的内容了
  3. 帮到你的话,点个免费的赞吧
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值