添加CSS:
/* make table selectable and copyable */
.x-grid-row ,.x-grid-cell, .x-unselectable, .x-unselectable * {
-webkit-user-select: text !important;
-o-user-select: text !important;
-khtml-user-select: all !important;
-ms-user-select: text !important;
user-select: text !important;
-moz-user-select: text !important;
}
然后在JS中:
/* make grid content selectable and copyable */
if(typeof Ext != 'undefined'){
Ext.core.Element.prototype.unselectable = function(){return this;};
Ext.view.TableChunker.metaRowTpl = [
'<tr class="' + Ext.baseCSSPrefix + 'grid-row {addlSelector} {[this.embedRowCls()]}" {[this.embedRowAttr()]}>',
'<tpl for="columns">',
'<td class="{cls} ' + Ext.baseCSSPrefix + 'grid-cell ' + Ext.baseCSSPrefix + 'grid-cell-{columnId} {{id}-modified} {{id}-tdCls} {[this.firstOrLastCls(xindex, xcount)]}" {{id}-tdAttr}><div class="' + Ext.baseCSSPrefix + 'grid-cell-inner ' + Ext.baseCSSPrefix + 'unselectable" style="{{id}-style}; text-align: {align};">{{id}}</div></td>',
'</tpl>',
'</tr>'
];
}
分享到:
相关推荐
在ExtJS中,这可能涉及到监听控件的选择事件,当用户选择了一些内容后,使用`Ext.util.Clipboard`类或者浏览器提供的API(如`navigator.clipboard.writeText()`)来将选中的数据放入剪贴板。 接着是“Paste”功能。...
下面将详细介绍如何在ExtJS表格中启用文本选择复制功能。 ### 知识点一:默认情况下ExtJS表格文本无法选择的原因 ExtJS Grid组件默认情况下会阻止用户通过鼠标选择表格中的文本,这是通过CSS来实现的。具体来说,...
### Extjs4学习指南 #### 1. Extjs初步 ##### 1.1 获取Extjs - **下载Extjs**:可以通过官方网站http://extjs.org.cn/获取Extjs的发布包和其他支持资源。 ##### 1.2 搭建学习环境 - **环境准备**:确保已安装...
本主题聚焦于如何扩展ExtJS库中的HtmlEditor组件,以便更好地处理来自Microsoft Word的复制粘贴操作以及表格操作。HtmlEditor是ExtJS提供的一款强大的富文本编辑器,允许用户在网页中创建和编辑HTML内容,类似于桌面...
Ext界面生成器正是针对这一需求而设计的一种工具,它可以帮助开发者通过简单的操作(如链接、复制、粘贴等)来快速构建出所需的用户界面。 根据提供的描述,“Ext界面生成器”是一个基于Web的应用程序,主要功能是...