ExtJs疑难杂症之GridPanel单元格不能选中复制问题
2010-01-19 12:10
344 查看
Ext.grid.GridPanel有一个重大缺陷,就是单元格的内容不能选中,没法选中就没法复制,给用户带来很多不便。
分析:
用IE Developer Toolbar打开ExtJs输出的代码研究了一下,发现每个单元格的div都有一个属性:unselectable="on",看来是css在作怪。
版本:
2.2
解决办法:
extJs官方论坛上有具体的解决办法,比较可行的如下。
step1:添加新的css样式。
CSS代码
<style type=
"text/css"
>
.x-selectable, .x-selectable * {
-moz-user-select: text!
important
;
-khtml-user-select: text!
important
;
}
</style>
step2:修改Ext.grid.GridPanel的protoType,我是自己写了一个新的js文件,记得要在ext-all.js后面引入。
JavaScript代码
if
(!Ext.grid.GridView.prototype.templates) {
Ext.grid.GridView.prototype.templates = {};
}
Ext.grid.GridView.prototype.templates.cell =
new
Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>'
,
'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>'
,
'</td>'
);
done!现在GridPanel的单元格可以选中了。
分析:
用IE Developer Toolbar打开ExtJs输出的代码研究了一下,发现每个单元格的div都有一个属性:unselectable="on",看来是css在作怪。
版本:
2.2
解决办法:
extJs官方论坛上有具体的解决办法,比较可行的如下。
step1:添加新的css样式。
CSS代码
<style type=
"text/css"
>
.x-selectable, .x-selectable * {
-moz-user-select: text!
important
;
-khtml-user-select: text!
important
;
}
</style>
step2:修改Ext.grid.GridPanel的protoType,我是自己写了一个新的js文件,记得要在ext-all.js后面引入。
JavaScript代码
if
(!Ext.grid.GridView.prototype.templates) {
Ext.grid.GridView.prototype.templates = {};
}
Ext.grid.GridView.prototype.templates.cell =
new
Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>'
,
'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>'
,
'</td>'
);
done!现在GridPanel的单元格可以选中了。
相关文章推荐
- ExtJs疑难杂症之GridPanel单元格不能选中复制问题
- ExtJs疑难杂症之GridPanel单元格不能选中复制问题
- [转]ExtJs疑难杂症之GridPanel单元格不能选中复制问题
- ExtJs疑难杂症之GridPanel单元格不能选中复制问题
- ExtJs的Ext.grid.GridPanel不能选择复制表格中的内容解决方案
- Extjs gridpanel 中的checkbox(复选框)根据某行的条件不能选中的解决方法
- ExtJS GridPanel加上复选框之后,行选中问题
- 解决extjs grid文字不能选中的问题
- Extjs gridpanel使用遇到selectionchange被多次触发问题解决办法,grid表格复选框无法取消选中
- ExtJs的Ext.grid.GridPanel不能选择复制表格中的内容解决方案
- Extjs grid 不能复制问题解决
- ExtJS 让grid里某行的checkbox不能选中
- ExtJs GridPanel单元格不能选中复制
- EXTJS GridPanel 右键复制当前选中单元格
- extjs关于treePanel+chekBox全部选中以及清空选中问题探讨
- extjs grid 复制问题还有一种解决方式.
- ExtJS EditorGridPanel中时间日期编辑问题的总结
- ExtJs中获得(GridPanel)选中的当前选中行号
- 解决Extjs的GridPanel在IE6下不显示滚动条问题