读书人

extjs4 - 报表内容可选中复制

发布时间: 2012-11-26 11:48:49 作者: rapoo

extjs4 - 表格内容可选中复制

添加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 {[this.embedRowAttr()]}>',

? ? ? ? ? ? '<tpl for="columns">',

? ? ? ? ? ? ? ? '<td {{id}-tdAttr}><div style="{{id}-style}; text-align: {align};">{{id}}</div></td>',

? ? ? ? ? ? '</tpl>',

? ? ? ? '</tr>'

?];

?}

读书人网 >JavaScript

热点推荐