From 0f2b5929248043d9c9f43929b5e641885d279761 Mon Sep 17 00:00:00 2001 From: legac <renaud.legac@free.fr> Date: Mon, 18 Nov 2013 09:36:30 +0100 Subject: [PATCH] ExtJS 4.2: start to play with Ext.ComponentLoader. --- controllers/reports.py | 12 ++++--- .../plugin_dbui/src/basepanelwithselector.js | 1 + .../plugin_dbui/src/panelwithurlselector.js | 31 ++++++++++--------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/controllers/reports.py b/controllers/reports.py index 57fac302..0f8ded05 100644 --- a/controllers/reports.py +++ b/controllers/reports.py @@ -22,15 +22,17 @@ def report_2(): """Return the URL arguments """ - selector = Selector(virtdb.foo1, extfield='my_format') + print "hello word" +# selector = Selector(virtdb.foo1, extfield='my_format') # user request a file with a specific format (latex,...) - iframe = selector.download() - if iframe: - return iframe +# iframe = selector.download() +# if iframe: +# return iframe # standart response with the selected values - return dict(test=selector.as_dict()) +# return dict(test=selector.as_dict()) + return "report_2" def report_3(): diff --git a/static/plugin_dbui/src/basepanelwithselector.js b/static/plugin_dbui/src/basepanelwithselector.js index 3b34052e..3a229d70 100644 --- a/static/plugin_dbui/src/basepanelwithselector.js +++ b/static/plugin_dbui/src/basepanelwithselector.js @@ -119,6 +119,7 @@ Ext.define('App.BasePanelWithSelector', { layout: 'border', items: [{ border: this.panelBorder, + loader: {}, layout: 'fit', itemId: 'mainPanel', items: this.panelCfg, diff --git a/static/plugin_dbui/src/panelwithurlselector.js b/static/plugin_dbui/src/panelwithurlselector.js index bef462eb..1a78c267 100644 --- a/static/plugin_dbui/src/panelwithurlselector.js +++ b/static/plugin_dbui/src/panelwithurlselector.js @@ -67,9 +67,7 @@ Ext.define('App.PanelWithUrlSelector', { // Private method requires by the ExtJS model initComponent: function () { - "use strict"; - - App.PanelWithUrlSelector.superclass.initComponent.call(this); + this.callParent(arguments); // connect the buttons this.goButton.on('click', this.onGo, this); @@ -79,12 +77,10 @@ Ext.define('App.PanelWithUrlSelector', { // Private method requires by the Ext JS component model beforeDestroy: function () { - "use strict"; - this.goButton.un('click', this.onGo, this); this.resetButton.un('click', this.onReset, this); - App.PanelWithUrlSelector.superclass.beforeDestroy.call(this); + this.callParent(arguments); }, /** @@ -96,9 +92,7 @@ Ext.define('App.PanelWithUrlSelector', { var fields, i, - mainPanel = this.getComponent('mainPanel'), params = {}, - selector = this.getComponent('selectorPanel'), url = this.baseUrl, urlCtrl = null, urlFunc = null, @@ -109,10 +103,11 @@ Ext.define('App.PanelWithUrlSelector', { } // activate the auto scrolling - mainPanel.setAutoScroll(true); + this.mainPanel.setAutoScroll(true); // extract basic parameters - fields = selector.findByType('field'); + fields = this.selectorPanel.query('field'); + for (i = 0; i < fields.length; i += 1) { if (fields[i].getName() === this.ctrlField) { urlCtrl = fields[i].getValue(); @@ -129,7 +124,7 @@ Ext.define('App.PanelWithUrlSelector', { } // extract parameters embedded in composite fields - fields = this.findByType('compositefield'); + fields = this.selectorPanel.query('fieldcontainer'); for (i = 0; i < fields.length; i += 1) { fields[i].items.eachKey(extract); } @@ -148,7 +143,10 @@ Ext.define('App.PanelWithUrlSelector', { } // load url in the main panel - mainPanel.load({ + console.log(this.mainPanel.getLoader()); + console.log(url); + console.log(params); + this.mainPanel.getLoader().load({ callback: this.onLoad, params: params, scope: this, @@ -175,6 +173,10 @@ Ext.define('App.PanelWithUrlSelector', { var panelWithSelector = this; + console.log(el); + console.log(success); + console.log(response); + // errors detection if (success === false) { el.updateManager.abort(); @@ -196,11 +198,10 @@ Ext.define('App.PanelWithUrlSelector', { "use strict"; var fields, - i, - selector = this.getComponent('selectorPanel'); + i; - fields = selector.findByType('field'); + fields = this.selectorPanel.query('field'); for (i = 0; i < fields.length; i += 1) { fields[i].reset(); } -- GitLab