`

Extjs的grid表格的复制、粘贴

 
阅读更多

局部定义表格复制、粘贴的样式:

1.在jsp、html中的<head></head>中添加css样式:

<style type="text/css"> 
     .x-selectable, .x-selectable * {  
          -moz-user-select: text!important;  
          -khtml-user-select: text!important;  
      }  
  </style>

2.在grid中添加:

grid=new Ext.grid.GridPanel({
        viewConfig: {     
    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>'
        )
     }  
   },
....})



全局定义复制、粘贴的样式:

1、在*.css文件中添加样式:


.x-selectable, .x-selectable * {  
          -moz-user-select: text!important;  
          -khtml-user-select: text!important;  
      } 
2、新建一个js文件,写入如下内容:

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>'
);

3、在每一个需要复制,粘贴的grid的中引入此js(注:必须在ext-all.js后引入)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics