|
|
@@ -9,9 +9,12 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
|
|
|
requires: [
|
|
|
'Ext.grid.plugin.Exporter'
|
|
|
],
|
|
|
- plugins: {
|
|
|
- gridexporter: true
|
|
|
- },
|
|
|
+
|
|
|
+ plugins: [{
|
|
|
+ ptype: 'gridexporter',
|
|
|
+ }, {
|
|
|
+ ptype: 'menuclipboard'
|
|
|
+ }],
|
|
|
|
|
|
idField:'',
|
|
|
codeField:'',
|
|
|
@@ -58,26 +61,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
|
|
|
}
|
|
|
|
|
|
Ext.apply(me, {
|
|
|
- actions: {
|
|
|
- copy: {
|
|
|
- iconCls: 'x-fa fa-copy',
|
|
|
- text: '复制单元格',
|
|
|
- handler: function() {
|
|
|
- me.onCopy(me.selectedData);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
viewConfig: {
|
|
|
deferEmptyText: false,
|
|
|
- emptyText: '无数据',
|
|
|
- listeners: {
|
|
|
- itemcontextmenu: function(view, rec, node, index, e) {
|
|
|
- e.stopEvent();
|
|
|
- me.getContextMenu().show().setLocalXY(e.getXY());
|
|
|
- me.selectedData = e.target.innerText;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ emptyText: '无数据'
|
|
|
},
|
|
|
columns: me.initColumns(),
|
|
|
store: Ext.create('Ext.data.Store', {
|
|
|
@@ -287,11 +273,19 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
|
|
|
// exportStyle: {
|
|
|
// format: 'Medium Date'
|
|
|
// },
|
|
|
+ copyRender: function(value) {
|
|
|
+ return Ext.Date.format(new Date(value), 'Y-m-d');
|
|
|
+ },
|
|
|
exportRenderer: function (value) {
|
|
|
return Ext.Date.format(new Date(value), 'Y-m-d');
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ if(c.xtype == 'numbercolumn') {
|
|
|
+ Ext.applyIf(c, {
|
|
|
+ align: 'end'
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
return columns;
|
|
|
@@ -422,29 +416,4 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
|
|
|
});
|
|
|
return data;
|
|
|
},
|
|
|
-
|
|
|
- getContextMenu: function() {
|
|
|
- var me = this;
|
|
|
-
|
|
|
- return me.contextMenu || (me.contextMenu = me.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);
|
|
|
- },
|
|
|
});
|