浏览代码

grid右键复制

zhuth 7 年之前
父节点
当前提交
82135a50c5

+ 5 - 3
frontend/saas-web/app/view/core/base/GridPanel.js

@@ -12,9 +12,11 @@ Ext.define('saas.view.core.base.GridPanel', {
     requires: [
         'Ext.grid.plugin.Exporter'
     ],
-    plugins: {
-        gridexporter: true
-    },
+    plugins: [{
+        ptype: 'gridexporter',
+    }, {
+        ptype: 'menuclipboard'
+    }],
 
     cls:'core-base-gridpanel',
     

+ 6 - 39
frontend/saas-web/app/view/core/report/ReportPanel.js

@@ -139,9 +139,11 @@ Ext.define('saas.view.core.report.ReportPanel', {
                 sortableColumns: false,
                 enableColumnHide: false,
                 rowLines: false,
-                plugins: {
-                    gridexporter: true
-                },
+                plugins: [{
+                    ptype: 'gridexporter',
+                }, {
+                    ptype: 'menuclipboard'
+                }],
                 features: [{
                     ftype: 'groupingsummary',
                     hideGroupedHeader: false,
@@ -159,15 +161,6 @@ Ext.define('saas.view.core.report.ReportPanel', {
                     displayInfo: true,
                     store: store
                 }],
-                actions: {
-                    copy: {
-                        iconCls: 'x-fa fa-copy',
-                        text: '复制单元格',
-                        handler: function() {
-                            me.onCopy(me.selectedData);
-                        }
-                    }
-                },
                 viewConfig: {
                     deferEmptyText: false,
                     emptyText: '无数据',
@@ -573,31 +566,5 @@ Ext.define('saas.view.core.report.ReportPanel', {
 
     applyParams: function(p) {
         return p;
-    },
-
-    getContextMenu: function() {
-        var me = this,
-        grid = me.items.items[1];
-
-        return grid.contextMenu || (grid.contextMenu = grid.add({
-            xtype: 'menu',
-            items: [
-                // Actions can be converted into MenuItems
-                '@copy',
-            ]
-        }));
-    },
-
-    onCopy: function(text) {
-		var target = Ext.DomHelper.append(document.body, {
-			tag: 'textarea',
-			style: 'opacity: 0;position: absolute;top: -10000px;right: 0;',
-			html: text
-		});
-		target.focus();
-		target.select();
-	    document.execCommand('Copy');
-	    target.blur();
-	    document.body.removeChild(target);
-	},
+    }
 });

+ 3 - 0
frontend/saas-web/app/view/document/kind/Kind.js

@@ -64,6 +64,9 @@ Ext.define('saas.view.document.kind.Kind', {
         margin: '10 0 0 0',
         flex: 1,
         frame:true,
+        plugins: [{
+            ptype: 'menuclipboard'
+        }],
         bind:{
             selection: '{selectedCompany}'
         },