PDA

View Full Version : Selector not selection and attachlisteners



bearnight
15 Aug 2013, 12:39 PM
I'm trying to grab a id from my controller the id is in the viewport and attaching a listener to it when the controller grabs the id and run after its render.
The problem is that its not grabbing the id from the viewport and attaching the listener.


here is my example code:https://gist.github.com/anonymous/6244605

tobiu
16 Aug 2013, 1:03 AM
this.control({
'editorPanel':{
afterrender:this.onEditorRender
}
});


checks for the xtype editorpanel which does not exist.

'#editorPanel' checks for id / itemId.

I strongly recommend to not use id configs at all, since they get applied on DOM level.

bearnight
16 Aug 2013, 5:47 AM
I have tried to grab both the by the xtype and itemId and using the # within the itemID both way was a no go.

tobiu
16 Aug 2013, 6:08 AM
using the # within the itemID


not inside the itemId itself, just inside the query.

like:


this.control({
'#editorPanel':{
afterrender:this.onEditorRender
}
});


you can not search for an xtype which you and the framework have not defined.

caleywoods
16 Aug 2013, 6:17 AM
Tobiu,

I work with bearnight and we've tried using the # within the this.control in an attempt to get the event to work and have not yet been able too.

We've also tried switching to an element further down that is of a custom xtype called 'htmleditors' and when attempting to use:


this.control({
'htmleditors' : {
afterrender: this.onEditorRender
}
});

Still with no luck. This is the first issue we've had with a controller not working correctly. I've even went so far as to try and attach the afterrender listener to the xtype "panel". We know the controller is being loaded since if you place a console.log() inside the init() function it is logged correctly.

caleywoods
16 Aug 2013, 6:41 AM
Tobiu,

We have fixed this now. The issue was in the Layout of our HTML page (being rendered via Zend Framework). Within this layout we had set the app.js for this Ext App to run but had failed to remove the app.js from another application (also available on this server). Since the secondary app.js was causing the controllers for the other application to load it was interfering in same way with registering the event listeners.

I also extracted the tabpanel and child htmleditor element into its own component to clean up the viewport and get away from using the ID in the Ext Controller.

Our resulting (and functioning) code now looks like this:

https://gist.github.com/anonymous/3ff34b82522eb038c3f6