View Full Version : Controller.control on items created with Ext.create not working as expected in 4.2

23 May 2013, 5:30 PM
**EDIT** Never mind, please ignore this, forgot to include my controller - face-palm :((

I just started a new project and thought that would be a good time to give 4.2 a try. In 4.1.x I would often store references to sub-items in a view for easier access like this:

title: 'Customer Information',
layout: 'anchor',
autoScroll: 'true',
width: 450,
defaults: {margin: 5},
items: [
me.CustomerType = Ext.form.field.ComboBox.create({
itemId: 'EntityTypeName',
fieldLabel: 'Customer Type',
name: 'EntityTypeName',
store: App.store.EntityType.create().load(),
displayField: 'EntityTypeName',
valueField: 'EntityTypeName',
queryMode: 'local',
width: 400,
forceSelection: true,
editable: false,
* TODO This is a hack - the Controller.control function doesn't seem to be working for me :-(
listeners: {
change: {
scope: this,
fn: this.setEntityType

Then in the Controller.control function, I would attach functions to the events using component query selectors using the itemId like this:

init: function(application) { this.control({
"#port #customer #EntityTypeName": {
change: this.onCustomerTypeChange

For some reason, the function is never fired for items created using Ext.create, only ones specified using a native object and xtype. I have made one major change when I switched to Ext 4.2 and that is that I'm no longer using the extended Controller class that I wrote which created the content views in it's init functions and had the ability to be destroyed/recreated. I'm guessing that could be the source of my problems, either that or it is no longer possible to use Ext.create with a controller. Am I missing something? I've been able to get the intended functionality by just putting the logic in the view and using the listener config on the components, but this certainly isn't ideal. The other option would be to define refs in the controller and stop using Ext.create, but I wanted to know if there was something else I might be missing or a best practice to follow?

Any help would be greatly appreciated and let me know if more information or the surrounding code is needed.

Also, there is a demo up and running of what I'm working on StephenTremaine.com/erp (http://StephenTremaine.com/erp)
I'm developing against it so it may be in a fluctuating state of half brokenness but if you have a heart of gold you are welcome to look at the controller and related view code in developer tools :-)

23 May 2013, 5:54 PM
Never mind, please ignore this, forgot to include my controller - face-palm :((