diff --git a/static/plugin_dbui/src/grid/plugin/Export.js b/static/plugin_dbui/src/grid/plugin/Export.js index 60aaae818b64a95ea95a90a21cefb9a5a8fb8bac..21ffedf209521d7b43102c00b52dc305379ac2a9 100644 --- a/static/plugin_dbui/src/grid/plugin/Export.js +++ b/static/plugin_dbui/src/grid/plugin/Export.js @@ -86,13 +86,20 @@ Ext.define('App.grid.plugin.Export', { }] }); - grid.on({ - 'containercontextmenu': this.onContainerContextMenu, - 'headercontextmenu': this.onHeaderContextMenu, - 'itemcontextmenu': this.onItemContextMenu, - scope: this - }); + // the menu pops up everywhere in the the grid, no context menu outside. + // Move from the Ext.component to the Ext.dom.element space. + grid.on('render', function(cmp){ + + cmp.body.on("contextmenu", function(event){ + event.stopEvent(); + this.menu.showAt(event.getXY()); + }, this); + + cmp.body.up(".x-panel-body").on("contextmenu", function(event){ + event.stopEvent(); + }, this); + }, this, {single: true}); }, /** @@ -112,11 +119,22 @@ Ext.define('App.grid.plugin.Export', { return value; }, + /** + * Destroy the plugin + * + */ + destroy: function () { + + "use strict"; + Ext.destroy(this.memu); + }, + /** * Get the label and the alignment of the visible columns. * * @return {Object} * @return {String[]} return.alignments + * @return {Boolean} return.hidden * @return {String[]} return.labels empty for hidden headers * */ @@ -146,27 +164,11 @@ Ext.define('App.grid.plugin.Export', { } } - if (container[0].hiddenHeaders) { - labels = []; - } - - return {alignments: alignments, labels: labels}; - }, - - /** - * Show the context menu when right clicking in an empty grid. - * - * @param {App.grid.Panel} grid - * @param {Ext.EventObject} event - * @param {Object} eOpts - * - */ - onContainerContextMenu: function (grid, event, eOpts) { - - "use strict"; - - event.stopEvent(); - this.menu.showAt(event.getXY()); + return { + alignments: alignments, + hidden: container[0].hiddenHeaders, + labels: labels + }; }, /** @@ -186,7 +188,7 @@ Ext.define('App.grid.plugin.Export', { total; // convert the header - if (header.labels.length) { + if (! header.hidden) { for (i = 0; i < header.labels.length; i += 1) { header.labels[i] = this.delimit(header.labels[i]); } @@ -236,40 +238,6 @@ Ext.define('App.grid.plugin.Export', { this.save("text/csv", "utf-8", lines); }, - /** - * Inhibit the context menu when right clicking in the grid header. - * - * @param {Ext.grid.header.Container} gridheader - * @param {Ext.grid.column.Column} column - * @param {Ext.EventObject} event - * @param {HTMLElement} html - * @param {Object} eOpts - * - */ - onHeaderContextMenu: function (gridheader, colum, event, html, eOpts) { - - "use strict"; - event.stopEvent(); - }, - - /** - * Show the context menu when right clicking in the non-empty grid. - * - * @param {Ext.view.View} view - * @param {Ext.data.Model} record - * @param {HTMLElement} item - * @param {Ext.EventObject} event - * @param {Object} eOpts - * - */ - onItemContextMenu: function (view, record, item, index, event, eOpts) { - - "use strict"; - - event.stopEvent(); - this.menu.showAt(event.getXY()); - }, - /** * Export the content of the grid as a LaTex file. * @@ -384,7 +352,7 @@ Ext.define('App.grid.plugin.Export', { lines.push(cmd); // table header - if (header.labels.length) { + if (! header.hidden) { lines.push(header.labels.join(' & ') + ' \\\\'); } diff --git a/views/reports/report_4.html b/views/reports/report_4.html index d48af783926b4faa11a076f68cfcc1a1b518488b..247eca3569dff4a3d4cf3e074599954f4bc20d1a 100644 --- a/views/reports/report_4.html +++ b/views/reports/report_4.html @@ -43,8 +43,8 @@ summaryType: 'sum' } ], - features: [{ftype:'grouping'}], - //features: [{ftype:'groupingsummary'}, {ftype:'summary'}], + //features: [{ftype:'grouping'}], + features: [{ftype:'groupingsummary'}, {ftype:'summary'}], forceFit: true, //hideHeaders: true, padding: "10 40 20 60",