I have an ExtJS4 application in which one controller (ControllerA) is loading another (ControllerB). Controller A has some user input that I need to set in ControllerB so that when ControllerB loads pulldowns it can by default jump those pulldowns to the correct value.
I can pass the values fine from ControllerA:
itemClick: function itemClick(distributor, product) {
var ctrlr = this.getController('Internal.controller.Popup');
var win = ctrlr.openWin(distributor, product);
ctrl.init();
}
The openwin function gets the values, I am just not sure how in that function I can save these values so that other functions in ControllerB can check if they exist and if so set the comboboxes appropriately ex:
openWin: function openWin(distributor, product) {
var win = Ext.create('Ext.window.Window', {
...
});
// Somehow set distributor and product
return win;
}
loadDistributorBox: function loadDistributorBox(str) {
//Listener for Ajax load of combobox values
var combobox = Ext.ComponentQuery.query('combobox')[0];
var items = str.getRange();
if (isset(distributor)) {
// Move the pulldown to the item that matches
} else {
// Show the default first value
}
}
First
Init the controller before you call any other function.
Second
Check if you have the arguments and set them. For that you can use the setValues methods of the baseform