Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to supply/change CSS style (not class) dynamically?

    Hi,

    I would like to apply a custom, code-generated CSS style to some elements on the fly. How can I do this?

    There is setStyleName, which sets CSS style name, but it can only apply a pre-existing CSS class, and I need to create my class definitions on the fly. Is there a way to set CSS style directly, and not via a class?

    Or is there a way to apply multiply CSS classes at once? (If there is, then I can pre-define the building blocks in static CSS, and apply the combination I need on the fly.)

    * * *

    An other aproach would be to generate the CSS files on the server side, with some servlets, but this would invole much more complexity than I would like to introduce for something as simple as this.


    What is the recommended approach for this?

    Thank you for your help:

    Csillag

    #2
    One way to create new styles on the fly would be to write out a <style> tag in the DOM. However, we have not tested how reliable this is on different browsers.

    There's currently no way to affect the HTML "style" attribute on a Canvas, although there are APIs such as ListGrid hilites and ListGrid.getCellCSSText() for specific elements.

    Comment


      #3
      I see. And currently, GWT UIObject's is support for multiple style is also disabled with an override, right? I might end up setting up servlets for CSS then...

      Comment

      Working...
      X