PDA

View Full Version : How to change style of a div.



blessan
29 Jun 2010, 4:45 AM
This is a very basic question. But i just cant find the answer. I have a div which i selected as

Ext.query('.addCustFolder .menu-button')[0].

This gives me a div. How can I set float to left for this in ext?

evant
29 Jun 2010, 4:56 AM
http://www.sencha.com/deploy/dev/docs/?class=Ext.Element&member=setStyle

Animal
29 Jun 2010, 4:57 AM
http://www.sencha.com/deploy/dev/docs/?class=Ext.Element&member=applyStyles

blessan
29 Jun 2010, 5:10 AM
I was looking for a example
i tried Ext.query('.addCustFolder .menu-button')[0].setStyle('float','left');
I know it a noob question. I just didnt get the syntax.

evant
29 Jun 2010, 5:13 AM
All this info is in the docs, you're trying to operate with Ext.Element methods on an HTMLElement



Ext.select('.addCustFolder .menu-button').first().setStyle('float','left');

mitchellsimoens
29 Jun 2010, 6:42 AM
http://www.sencha.com/deploy/dev/docs/?class=Ext.Element&member=applyStyles

I would go with setStyle over applyStyles as setStyle will work with Ext Core and applyStyles does not. I mention this because only because you can get the same result using both but one is compatible with both ExtJS and Ext Core so why not.