View Full Version : Alias for Ext.ComponentQuery.query()

12 Jan 2012, 9:15 AM
Ext.ComponentQuery.query() is an amazingly powerful and useful function. I've been using it all over the place. The only problem with it is that it's a pretty long name for something that's used so often - in jQuery, for example, a roughly analogous function is aliased to $() for convenience.

So, since I couldn't find anything in PR3 regarding an alias for this function, I created my own:

/* Create alias "Ext.cq()" for "Ext.ComponentQuery.query()".

var applyButton = Ext.cq('[action="apply"]', this)[0];
Ext.cq = Ext.Function.alias(Ext.ComponentQuery, 'query');

Perhaps the Sencha team would consider including a similar alias in the final version of Sencha Touch 2?

12 Jan 2012, 10:32 AM
Each component has convenient methods to do this... child, down, query, up