PDA

View Full Version : selector for last form field



stevanicus
4 Jun 2012, 5:02 AM
Would be very grateful if anyone could tell me how to write the selector correctly so that I can access the specialkey event on the last field in a form.

Thanks

P.s. here is what I have in my controller so far:


'myformpanel [isFormField=true]:last-child':{
specialkey:function(){
console.info("hello hello");
}
}

friend
4 Jun 2012, 11:09 AM
This worked for me using a sample form:



Ext.ComponentQuery.query('form field:last')[0]

stevanicus
5 Jun 2012, 1:02 AM
thanks.... its works if you use the Component Query... but what if you use the controller query


init : function() {


this.control({

'myformpanel field:last':{
focus:function(){
console.info("focus!");
},
specialkey:function(){
console.info("hello");
}
}
});

}

then it doesn't work :(

stevanicus
7 Jun 2012, 7:15 AM
*bump*

friend
7 Jun 2012, 9:27 AM
You're right, this doesn't appear to work in the context of a Controller...

I tried several permutations on the selector and still no luck.

stevanicus
7 Jun 2012, 10:07 AM
I tried debugging the source code a little, filterByPseudo does return the correct component and the event and selector seem to register correctly but it seems as though the controller doesn't pick it up.


P.s thanks for your reply

stevanicus
8 Jun 2012, 12:49 AM
I've registered it as a bug with a workaround

http://www.sencha.com/forum/showthread.php?215340-Controller-Selector-Doesnt-Respond&p=824792#post824792