1

How to check the style properties in extjs?

To set a style to a panel, we can use setBodyStyle. After setting the style, I want to check the value of a particular property.

Like,

var panel = Ext.getCmp('id');
if(panel.getStyles().fontSize == 24) //for example
    //do this stuff
else
    //do the other stuff

I am using extjs 4.1.1a

Mr_Green
  • 40,727
  • 45
  • 159
  • 271

1 Answers1

4

These methods are only available on Ext.dom.Element level. Meaning you will need to call

var panel = Ext.getCmp('id');
if(panel.el.isStyle('fontSize', 24)) //for example
    //do this stuff
else
    //do the other stuff

Please se the API for Ext.dom.Element (you may filter by 'style' for quick access)

sra
  • 23,820
  • 7
  • 55
  • 89
  • Thanks this worked.. I got one last doubt(I think).. How to align the text inside the panel to middle? – Mr_Green Feb 08 '13 at 05:39
  • Please come once on chat.. I have one doubt which I can't ask on SO. http://chat.stackoverflow.com/rooms/23760/sencha – Mr_Green Feb 08 '13 at 09:04
  • Sorry I didn't came on time by calling you.. please check this post http://stackoverflow.com/q/14772729/1577396 – Mr_Green Feb 08 '13 at 12:41