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. Xamarin 安装步骤

    原文:Xamarin 安装步骤 1.下载并解压吾乐吧软件站提供的“Mono for Android 离线包” 安装:jdk-6u45-windows-i586.exe (就算你是64位系统,也要安装i ...

  2. Operand should contain 1 column(s)

    今天sql当测试发现错误:Operand should contain 1 column(s). 因为in背后有多种条件字段,in只有有背后场.

  3. C++转让Lua

    转载请注明出处:http://blog.csdn.net/zhy_cheng/article/details/39756423 我使用的cocos2d-x版本号是2.3.3.先在一个C++projec ...

  4. ASP.NET Core MVC Hello World

    ASP.NET Core 现在ASP.NET Core还在不断成长.更新中,说不定到了明天又换了个模样,就如同一个小孩,从蹒跚学步,到奔向未来. 所以我们可以相应的去理解更新中所发生的变化,包容它.呵 ...

  5. POJ培训计划2253_Frogger(最短/floyd)

    解决报告 意甲冠军: 乞讨0至1所有最大的道路值的最小数量. 思维: floyd. #include <iostream> #include <cstdio> #include ...

  6. SqlServer保留几位小数的两种做法

    SqlServer保留几位小数的两种做法   数据库里的 float momey 类型,都会精确到多位小数.但有时候 我们不需要那么精确,例如,只精确到两位有效数字. 解决: 1. 使用 Round( ...

  7. fork与vfork详解

    一.fork函数 要创建一个进程,最基本的系统调用是fork,系统调用fork用于派生一个进程,函数原型如下: pid_t fork(void)  若成功,父进程中返回子进程ID,子进程中返回0,若出 ...

  8. HDU 1695 GCD 欧拉函数+容斥原理+质因数分解

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=1695 题意:在[a,b]中的x,在[c,d]中的y,求x与y的最大公约数为k的组合有多少.(a=1, a ...

  9. ios pop 折叠动画

    今天写了一个很有趣的电影太,我们可以去githoub下载. 这部动画是高级写作,我参考了它.而凝视,我希望你能看的懂. 各种动画.事实上,一些不起眼的开始.我也只是摸索. 我希望有更多的交流.[   ...

  10. sublime配置攻略

    大家好,今天给大家分享的编辑器:sublime text2     我用过非常多编辑器, EditPlus.EmEditor.Notepad++.Notepad2.UltraEdit.Editra.V ...