Skip to content
Snippets Groups Projects
Commit 0f2b5929 authored by legac's avatar legac
Browse files

ExtJS 4.2: start to play with Ext.ComponentLoader.

parent 9fbe199b
No related branches found
No related tags found
No related merge requests found
......@@ -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():
......
......@@ -119,6 +119,7 @@ Ext.define('App.BasePanelWithSelector', {
layout: 'border',
items: [{
border: this.panelBorder,
loader: {},
layout: 'fit',
itemId: 'mainPanel',
items: this.panelCfg,
......
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment