PDA

View Full Version : Reset style of toolbar



timomueller
6 Jan 2013, 8:00 AM
Hi,

I changed the background color of a toolbar using the setStyle-method with the following CSS style attribute: background: 'yellow'.

This works perfect, but I would like to change the look&feel of this view component to its original style. I found no opportunity to reset the manual style manipulation, so that the original look&feel can be restored.

I would be very happy if someone could help me on that.


Thanks a lot!

bricemason
7 Jan 2013, 12:16 PM
Why not just add/remove css classes?

http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-method-addCls
http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-method-removeCls

Brice

timomueller
27 Mar 2013, 12:04 PM
Hi,

you would help me a lot if you could tell me how I can realize this.

I tried to add a specific background color using the following implementation:

toolbar.addCls('color_yellow');

In my CSS you can find the following entry:

.color_yellow {
background: 'yellow'
}

Unfortunately the color does not change.

bricemason
27 Mar 2013, 7:12 PM
If you change your css from:


.color_yellow {
background: 'yellow'
}


to


.color_yellow {
background : yellow;
}

it'll work.

As an aside, if you want to make that color change to your toolbar and have it render a consistent look and feel, particularly if you're putting other items inside it such as buttons, have a look at generating a ui class for it. This is done by adding the following to your app.scss file:


@include sencha-toolbar-ui('yellow', yellow);

then re-compiling your styles using the command compass compile --force.

This will generate a ui named 'yellow' using the base color of yellow. It will generate a bunch of css classes that will consistently change the look and feel of the toolbar and all items within it. You can dynamically change the ui of your toolbar by:


someToolbar.setUi('yellow');

But again, for your specific question you just need to edit your css rule so it evaluates.

Brice

timomueller
28 Mar 2013, 1:23 AM
Hi Brice,

thanks a lot for your help, this works absolutely fine for me :-)


Cheers,
Timo