Ext.grid 复制

来源:互联网 发布:android 淘宝搜索 编辑:程序博客网 时间:2024/05/22 12:16

 解决办法: 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 = newExt.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的单元格可以选中了。

********************************************

单个Grid禁止复制

1..GridPanel增加属性

       baseCls : "unselectable",

2.css样式

   .unselectable {
        -moz-user-select:none;
        hutia:expression(this.onselectstart=function(){return(false)});
  }

 

原创粉丝点击