Announcement

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

    DateItem / DateTimeItem Styling is not working?

    Code:
    public class Application implements EntryPoint {
     VLayout vLayout = new VLayout(5);
    
            DynamicForm form = new DynamicForm();
    
            form = new DynamicForm();
    
            TextItem name = new TextItem("name", "Event Name");
            name.setTextBoxStyle("backgroundRed");
            DateTimeItem dateItem1 = new DateTimeItem("Date", "Date");
            dateItem1.setTextBoxStyle("backgroundRed");
            DateItem dateItem2 = new DateItem("Date", "Date");
            dateItem2.setUseTextField(true);
            dateItem2.setTextBoxStyle("backgroundRed");
    
            form.setFields(new FormItem[]{name, dateItem1, dateItem2});
    
            vLayout.addMember(form);
    
            RootPanel.get().add(vLayout);
    The output DOM do not get the backgroundRed style in the dateItem and dateTimeItem.But the textItem get the backgroundRed style.
    I try to do some hack with GwtQuery, like
    Code:
    GQuery formInputElemet = GQuery.$("input");
    for (Element element : formInputElemet.elements()) {
       element.addClassName("backgroundRed");
    }
    }
    but the smart client remove the style class quickly.
    Any hint?
    Thanks
    Last edited by laibilly; 18 Mar 2010, 07:01.

    #2
    Hi...

    I used the following solution: for DateTimeItem sets attribute named "type" and value for example "customDateTime". In javascript file (i used sun theme - load_skin.js) put the following lines:

    Code:
    isc.defineClass("CustomDateTimeItem", "TextItem").addProperties({
        setTextBoxStyle:"customDateTimeTextComponent"
    });
    "customDateTimeTextComponent" - is style name from CSS

    Comment


      #3
      I found a solution:

      Code:
      DateItem item = new DateItem();
      item.setUseTextField(true);
      Map<String, String> properties = new HashMap<String,String>();
      properties.put("textBoxStyle", "yourCustomStyleHERE");
      item.setAttribute("textFieldProperties", properties);
      It works for me, hope it helps :-)

      Comment

      Working...
      X