PDA

View Full Version : .down VS Ext.ComponentQuery



MrjGeek
9 Mar 2015, 9:54 AM
Hi.
I wonder if there are differences in performance between issues:


form.down (#mybutton)


and


Ext.ComponentQuery.query ('myform #mybutton) [0]


Thank U

kell
9 Mar 2015, 1:35 PM
I would guess down is more efficient because the container starts the query from within itself.

Here is the code I found from Ext.Container...

down: function (selector) {
if (selector && selector.isComponent) {
selector = '#' + Ext.escapeId(selector.getItemId());
}

selector = selector || '';
return this.query(selector)[0] || null;
}

query : function(selector) {
selector = selector || '*';
return Ext.ComponentQuery.query(selector, this);
}

Notice how it eventually calls Ext.ComponentQuery.query passing itself as the second parameter.

MrjGeek
10 Mar 2015, 10:41 AM
Thanks for your reply.