diff --git a/controllers/reports.py b/controllers/reports.py index 6fb4384558a451c03a306eb4aac0a3df3249e100..5440b3611a7f7bf0c6e8fd668b3b576ffcc40689 100644 --- a/controllers/reports.py +++ b/controllers/reports.py @@ -30,7 +30,7 @@ def report_2(): time.sleep(5) # standard response with the selected values - return dict(test=selector.as_dict()) + return dict(test=selector.as_dict(), vars=request.vars) def report_3(): diff --git a/models/widgets_viewport.py b/models/widgets_viewport.py index a7fd315ee58aacad4e49130b50d45c4e17ee1138..f5d1af816066bee6387e9451577abb39ebc7c9b0 100644 --- a/models/widgets_viewport.py +++ b/models/widgets_viewport.py @@ -49,6 +49,7 @@ leaf_1 = dbui.Panel(html="salut ma poule") leaf_2 = dbui.to_panelWithUrlSelector(virtdb.foo1, baseUrl=URL('reports', 'report_2'), + baseParams={'hello': 3}, extField='my_format', plugins=['pMathJax']) diff --git a/static/plugin_dbui/src/panel/WithUrlSelector.js b/static/plugin_dbui/src/panel/WithUrlSelector.js index f1e4010f4ebfbe0bd90e80ded6cc0adb6ddfceec..9f121b2e0e68cabc24a4804c6dae398bdba11d00 100644 --- a/static/plugin_dbui/src/panel/WithUrlSelector.js +++ b/static/plugin_dbui/src/panel/WithUrlSelector.js @@ -17,6 +17,13 @@ Ext.define('App.panel.WithUrlSelector', { extend: 'App.panel.BaseWithSelector', alias: 'widget.xpanelwithurlselector', + /** + * @cfg {Object} baseParams + * Params that will be attached to every URL request. + * These parameters will not be overridden by the load options. + */ + baseParams: null, + /** * @cfg {String} * The well-formed URL, e.g http://blabla. @@ -59,6 +66,10 @@ Ext.define('App.panel.WithUrlSelector', { this.callParent(arguments); + if (this.baseParams) { + this.mainPanel.loader.baseParams = this.baseParams; + } + this.goButton.on('click', this.onGo, this); this.resetButton.on('click', this.onReset, this); }, @@ -195,6 +206,7 @@ Ext.define('App.panel.WithUrlSelector', { }; this.mainPanel.getLoader().load({ + baseParams: this.baseParams, loadMask: mask, params: request.vars, url: request.http, diff --git a/views/reports/report_2.html b/views/reports/report_2.html index c082d94fc0d0aaeacbfd2e2444993f3e2e8e2813..def402bd7c7e063271c2f59d481e98757717af6c 100644 --- a/views/reports/report_2.html +++ b/views/reports/report_2.html @@ -1,4 +1,8 @@ <h3>Report_2</h3> <hr> +<h4>selector:</h4> {{=BEAUTIFY(test)}} -<hr> \ No newline at end of file +<hr> +<h4>request.vars:</h4> +{{=BEAUTIFY(vars)}} +<hr>