PDA

View Full Version : Render and afterrender in ExtJS 4.1 don't work



guyfawkes
25 Apr 2012, 3:56 AM
Hello. I just downloaded ExtJS 4.1 Final. I use control method in my controller to do some actions on panel and treepanel render. This code works perfectrly in ExtJS 4.0.7, but it doesn't works in ExtJS 4.1 Final. How can I to fix this problem? Example: trivial method init in Controller: init : function () { var me = this, me.control({ 'managers-groupstree' : { render : function (component) { alert('never works!'); }, ... View is simle TreePanel with alias : 'widget.managers-groupstree'.

scottmartin
25 Apr 2012, 1:45 PM
Can you please provide a small test case of your problem so we can have a look?

Regards,
Scott.

guyfawkes
25 Apr 2012, 10:44 PM
I added example. Sorry, but I haven't format controls in forum message form, but in settings there are wysiwyg.

khmurach
26 Apr 2012, 4:25 AM
Works fine for me. Demo here http://ext4all.com/post/render-afterrender-and-boxready-in-extjs-4-1

vasanth.kvj
14 May 2012, 7:50 AM
Yes afterrender is not working for me in 4.1, but the same works perfectly in 4.0.7

In controller
-----------------
'#megamenuclose': {
afterrender: function (cmp) {
cmp.getEl().on('click', this.closeMenu);
}
}

castitas
14 May 2012, 11:27 AM
Both of these events are working for me. Some things to check:
1) Are you sure your reference is right? Try it out in Ext.ComponentQuery.query('ref').
2) Check your spelling. itemid is different from itemId.
3) Did you declare the itemId/xtype?

vasanth.kvj
14 May 2012, 10:06 PM
Thanks Castitas.

1. Yes reference that I'm using is id of the component.
2. Im not using itemId and using xtype.

Code:
----------
items:[{
xtype: 'container',
autoEl: {
tag: 'a',
cls: 's-close',
id: 'megamenuclose',
html: ' ',
title: 'Close'
}
}]

Corresponding Html
-----------------------------
<a title="Close" class="s-close" id="megamenuclose"><div role="presentation" class="x-clear" id="container-1071-clearEl"></div>&nbsp;</a>

Controller
------------
'#megamenuclose': {
afterrender: function (cmp) {
cmp.getEl().on('click', this.closeMegaMenu);
}
}

castitas
15 May 2012, 9:07 AM
this.control cannot resolve elements, just components

http://www.sencha.com/forum/showthread.php?177850-How-to-reference-component-in-controller-when-using-autoEl-to-reference-link

Does this help?