I'm looking for an equivalent method to select a class element like this $(".className") in Jquery for ExtJS.
I understand that Ext.get() only takes in an id. Your help will be very much appreciated.
Cheers, Mickey
Edited:
Let me explain further. I want to be able to do something like Ext.get after I did a "select". For example:
$(".className").css("width");
I understand that Ext.Element has getWidth() method. I was hoping I can do something like...
Ext.select(".className").getWidth(); // it just return me [Object object]
Maybe i don't understand it well.
Thanks a mil.
Yes, Ext.select() is what you want. It returns a CompositeElement (same API as a single Element, but contains an internal collection of all selected elements). You could do this to see the widths of each element:
Ext.select('.className').each(function(el){
console.log(el.getWidth());
});
The way you called it is more useful for operating on the elements in some way, e.g.:
Ext.select('.className').setWidth(100);
I think you are looking for:
Ext.query(".className");
This method allows you to get elements by the given query string like jQuery does.
EDIT
var els=Ext.query(".className"), ret=[];
for(var i=0; i<els.length; i++)
{
ret.push(els[i].getWidth());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With