I am currently evaluating ExtJS for an upcoming project and I am wondering how dynamic styles can be applied to controls being rendered from a server. The control definitions are being retrieved from a third party API that has each control style specified and I am reading these settings and transposing them into html elements, but I want to use the ExtJS library instead. I just haven't been able to get beyond the css issues and using stylesheets isn't an option. In some instances, I need to set the background colors of textboxes and buttons.
Any assistance would be greatly appreciated. I am liking what I see so far and love the object oriented functionality of this library.
I would think that would be a nitemare to implement and maintain. You could use the methods of the Element class to applyStyle, setStyle, etc. However, you'd have to do this for every element, and you'd have to dig into the CSS anyway to understand what styles you'd need to change. And if you're not going to use the ext-all.css file, that's going to be a monstrous number of styles to set, not withstanding the fact that there are many elements built during the construction of an Ext widget that are not necessarily easily accessible without using DomQuery as they don't have an id assigned. I suggest you use Firebug to look at rendered HTML of some of the examples - maybe the dynamic form, and get an idea of what you would be undertaking.
Thanks a lot for your input. I was afraid this would be the case. Yes, this is going to be a nitemare and a monstrous number of styles to set. I had built a framework that implemented a decent interface about a year ago and have been trying to improve on it as time has gone by, but when I stumbled upon ExtJS, I was floored and thought that this would be the perfect library to replace my current code. My current application:
lacks the end-user UI that I wanted. I coded this application using standard HTML being streamed in using ASP.NET. It was pretty efficient but I wanted a better look and feel and better performance using my AJAX engine. The biggest hurdle that I have been facing with this and the reason I need to control the styles is because the third party application I am interfacing with has a GUI Designer that end-users use to configure their interface with whatever colors they want and whatever controls they want connected to database tables. So, I just read the API and gather these settings and build the controls on the fly translating the colors and control properties into HTML attributes. Works pretty well, but, I want to improve on the GUI and I think ExtJS will allow me to do that.
What I may have to do is incorporate the ExtJS library into my application for the GUI look and utilize standard HTML tags for the form portions of the application. That way I can control that portion of the HTML.
Once again, Thank You. I am quite impressed with ExtJS and I will continue my evaluation of ExtJS until I am comfortable with the library enough to design a prototype for some of my customers.