Extjs里有个actioncolumn,但actioncolumn只能添加一系列button,不能既有字又有button

如何能在column里增加html标签,并给button添加事件呢?

1. 首先,在column里重写renderer方法,方法里拼html语句

View里主要代码如下:

 columns: [{
header: 'Complex column',
width: 90,
renderer: function(value, cellmeta, record) {
var display="Text";
display+='</br>';
display+='<input type="image" class="add" src="extjs/resources/themes/images/spinner.gif" alt="Add" />';
display+='<input type="image" class="edit" src="extjs/resources/themes/images/spinner.gif" alt="Edit">';
display+='<input type="image" class="delete" src="extjs/resources/themes/images/spinner.gif" alt="Delete">';
return display;
}
}]

2. 在Controller里添加事件

init : function() {
console.log('The window was rendered');
this.control({
'ResultPage > grid[id=resultGrid]':{
cellclick:this.cellClick
}
});
}, cellClick : function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
console.log("cell clicked");
var add = e.getTarget('.add');
var edit = e.getTarget('.edit');
var del = e.getTarget('.delete');
if (add) {
console.log("click add");
}
if(edit){
console.log("click edit");
}
if(del){
console.log("click del");
}
}

这里有一点要注意,html里用class标识,然后在事件里用getTarget('.add')去寻找。我尝试在html里用id,getTarget(id)找不到。

Extjs grid column里添加button等html标签,并增加点击事件的更多相关文章

  1. ListView的item中有button和checkbox,listview的点击事件无效

    ListView的item中有button和checkbox,listview的点击事件无效,解决办法: 在item布局文件中的根控件中添加属性设置: android:descendantFocusa ...

  2. Android监听Button和ImageButton控件的点击事件

    一.onClick事件 Button和ImageButton都有一个onClick事件,通过自身的.setOnClickListener(OnClickListener)方法添加点击事件 所有的控件都 ...

  3. Button控件的三种点击事件

    ①在布局文件中指定onClick属性的方法设置点击事件 ②使用匿名内部类的方法设置点击事件 ③实现Activity实现OnClickListen接口的方式设置点击事件 linear.xml文件 < ...

  4. 关于在"a"标签中添加点击事件的一些问题

    昨天做修改页面跳转时遇到一个问题,如果a标签的"href"属性为空的话,比如这样<a href="" onclick="roleupdate() ...

  5. [Swift通天遁地]一、超级工具-(1)动态标签:给UILabel文字中的Flag和url添加点击事件

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  6. [WPF] 为Style 里的button添加鼠标点击响应事件

    一个TabControl, 用的是PagedTabControl style, 在style中有个button, button在style里已经写了click事件,但是现在还需要加上一段功能,就是在响 ...

  7. extjs grid renderer用法

    extjs grid renderer用法 摘自:http://www.cnblogs.com/ljian/archive/2011/10/27/2226959.html var cm = new E ...

  8. [Ext JS 4] 实战之Grid, Tree Gird 添加按钮列

    引言 贴一个grid 的例子先: 有这样一个需求: 1. 给 Grid(or Tree Grid)添加一列, 这一列显示是Button. 点击之后可以对这一行进行一些操作 2. 这一列每一行对应的按钮 ...

  9. ExtJS Grid导出excel文件

    ExtJS Grid导出excel文件, 需下载POI:链接:http://pan.baidu.com/s/1i3lkPhF 密码:rqbg 1.将Grid表格数据连同表格列名传到后台 2.后台导出e ...

随机推荐

  1. windows phone (13) 样式继承

    原文:windows phone (13) 样式继承 在上一遍文章中已经介绍到可以在Resources集合中定义样式,我们也可以在一个样式上引用其他的样式,这就是继承的概念,使用方法是将引用的样式放置 ...

  2. vultr centos x64 6.5.x 升级php7.0

    升级前,先卸载 php5.6.x 卸载php5.6.2 从cent 6.5.x 需要卸载: yum remove php56u-mysqlnd-5.6.20-1.ius.centos6.x86_64 ...

  3. uip UDPclient模式通信移植,当地port随机

    现在移植UDPclient模式,测试广播地址. //udp_client.c /************************************************************ ...

  4. 央视公然诽谤Linux操作系统,谁报告?

    考虑下面的观点: 这是今年5月111日上午11点04分央视播出的一则新闻,题为"工信部希望用户使用国产操作系统(替代XP). 该新闻报道,概念混乱,违背事实,误导公众,谁来举报?现举一例加以 ...

  5. BootStrap -- Grid System

    <script src="jquery.1.9.js"></script> <script src="js/bootstrap.min.js ...

  6. eclipse-jee 配置tomcat7,解决404错误

    在eclipse的Servers窗口新建一个tomcat7,配置tomcat的安装路径,然后启动tomcat,访问http://localhost:8080/,但是报404错误,恼火!没有找到要访问的 ...

  7. ssh否password登陆server

    在线辅导课非常多,但仍录,使用时方便日后查询. 两server,内联网ip每间: 172.16.3.91 (本地计算机) 172.16.3.92 (远程机) 现在想在本地计算机上通过ssh 172.1 ...

  8. OPhone SDK初体验

    OPhone SDK初体验 write by 九天雁翎(JTianLing) -- blog.csdn.net/vagrxie 讨论新闻组及文件 背景说明 中国伟大的垄断龙头,世界上也是顶尖的中移动最 ...

  9. hdu1711 Number Sequence

    Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], .... ...

  10. 【转】c++继承:公有、私有、保护

    原文链接:http://www.cnblogs.com/qlwy/archive/2011/08/25/2153584.html 公有继承(public).私有继承(private).保护继承(pro ...