PDA

View Full Version : :first selector throwing an object error



nmcbride
10 Mar 2012, 6:41 AM
Quick question for everyone. I'm trying to get accustomed to how ExtJS's querying works and I'm apparently not understanding something.

If I do this on a form panels render event:

this.query('*')

It returns all 5 objects I'd expect it to. A displayfield, combobox, toolbar, fill, and button. However when I do this:


this.query('*:first')

I expect it to just return the first object but instead I get an error:

Uncaught TypeError: Property 'first' of object #<Object> is not a function

I get the same error if I this also:


this.query('combobox:first')

What am I doing wrong?

Thank you,

Nate

vietits
10 Mar 2012, 5:35 PM
Default implementation of Ext.ComponentQuery does not support 'first' pseudo class. You can add your own pseudo classes to Ext.ComponentQuery as below:


Ext.ComponentQuery.pseudos.first = function(items) {
return items ? items[0] : null;
};

LesJ
9 Jul 2012, 7:35 AM
Default implementation of Ext.ComponentQuery does not support 'first' pseudo class. You can add your own pseudo classes to Ext.ComponentQuery as below:


Ext.ComponentQuery.pseudos.first = function(items) {
return items ? items[0] : null;
};


This is fixed in 4.1.1 GA