PDA

View Full Version : Update css dynamically



Michael J.
25 Nov 2010, 11:51 PM
Hello, I have 2 similar problems.
First - I want to change ProgressBar style - for example if progress is more then 90% change the color of progress line. Im looking for some way without creating class in .css file - just to add style dinamically from script.

And the second - Im using table Layout to disblay components(not text) in cells, but cannot set allign = 'center', I found the suggestion for text content, but no for components, I think the dessigion is the same - to aplay css style dynamicaly but I dont know how.

Thanks in advance.

Condor
26 Nov 2010, 1:27 AM
Something like:

pb.on('update', function(pb, value, text){
pb.progressBar.setStyle('background-color', <color-based-on-value>);
});

I recommend using hbox/vbox layout instead of table layout. Box layout makes it much easier to center and to properly size components.

Michael J.
21 Dec 2010, 4:07 AM
Thanks, thats great!