PDA

View Full Version : Ext.select('.cssClass').getWidth()



lasseok
17 Jan 2012, 2:44 AM
If I execute the following line of code (either in initComponent, onReady or directly in Firebug/Web Dev Tools)



Ext.select('.wrapper').getWidth()


...I get back a Ext.CompositeElementLite. I expected to get back the width of the element as suggested by the Ext.Element documentation (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Element).

Any idea why that is?

Thanks!

mankz
17 Jan 2012, 3:29 AM
Ext.select selects multiple elements so it doesn't make sense to call getWidth on the result. Try


Ext.getBody().down('.wrapper').getWidth()

lasseok
17 Jan 2012, 3:42 AM
Of course. Makes sense.

It works. Thank you very much!