Announcement

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

    Strange rendering behavior of DateItem and SelectItem across different browsers

    Hi,

    I have noticed some rendering problems of the DateItem and SelectItem widget. Across different browsers I get different renderings but none of them is really correct. I do not know what the showcase sample does so that the rendering there is correct, but if I try to use the sample code outside of the showcase environment I get the following renderings.


    Internet Explorer 11: Click image for larger version

Name:	2015-10-22 13_48_07-SmartGWT Test - Internet Explorer 11.png
Views:	26
Size:	5.9 KB
ID:	232195

    Chrome 46: Click image for larger version

Name:	2015-10-22 13_48_07-SmartGWT Test - Chrome 46.png
Views:	25
Size:	7.1 KB
ID:	232196

    Firefox 41: Click image for larger version

Name:	2015-10-22 13_48_07-SmartGWT Test - Firefox 41.png
Views:	20
Size:	4.4 KB
ID:	232197

    As you can see in the images only the ComboBoxItem is rendered correct. So it seems to be possible. The SelectItemText of the DateItem and SelectItem have either an incorrect height or the text is at the bottom of the SelectItemText and is not centered as it should be. In Firefox we can see additionally that the form items in this case exceed the form group itself.


    My sample code is:

    Code:
    [B]package[/B] com.mycompany.client;
     
    [B]import[/B] java.util.LinkedHashMap;
     
    [B]import[/B] com.google.gwt.core.client.EntryPoint;
    [B]import[/B] com.smartgwt.client.widgets.form.DynamicForm;
    [B]import[/B] com.smartgwt.client.widgets.form.fields.ComboBoxItem;
    [B]import[/B] com.smartgwt.client.widgets.form.fields.DateItem;
    [B]import[/B] com.smartgwt.client.widgets.form.fields.SelectItem;
    [B]import[/B] com.smartgwt.client.widgets.layout.VLayout;
     
    [B]public[/B] [B]class[/B] HelloWorld [B]implements[/B] EntryPoint
    {
      @Override
      [B]public[/B] [B]void[/B] onModuleLoad()
      {
        DynamicForm form = [B]new[/B] DynamicForm();
        form.setWidth(450);
        form.setColWidths(120, "*");
        form.setIsGroup([B]true[/B]);
        form.setGroupTitle("Controls");
      
        DateItem dateItem = [B]new[/B] DateItem();
        dateItem.setTitle("Date");
        dateItem.setHint("<nobr>Picklist based date input</nobr>");
      
        LinkedHashMap<String, String> valueMap = [B]new[/B] LinkedHashMap<String, String>();
        valueMap.put("US", "United States");
        valueMap.put("CH", "China");
        valueMap.put("JA", "Japan");
     
        SelectItem selectItem = [B]new[/B] SelectItem();
        selectItem.setTitle("Select");
        selectItem.setHint("<nobr>A select item</nobr>");
        selectItem.setValueMap(valueMap);
        selectItem.setDefaultValue("US");
     
        ComboBoxItem comboBoxItem = [B]new[/B] ComboBoxItem();
        comboBoxItem.setTitle("Combo Box");
        comboBoxItem.setHint("<nobr>A combo box item</nobr>");
        comboBoxItem.setValueMap(valueMap);
        comboBoxItem.setDefaultValue("US");
     
        form.setItems(dateItem, selectItem, comboBoxItem);
      
        VLayout layout = [B]new[/B] VLayout(10);
        layout.addMember(form);
        layout.setMargin(30);
        layout.draw();  
      }
    }
    What is wrong in my sample or what can I do in my sample to get the correct rendering as in the showcase? In my opinion a wrong calculation of the height of the SelectItem causes the various problems.

    I use the LGPL SmartGWT 5.0p version from 2015-10-14.

    Regards
    Last edited by eko; 22 Oct 2015, 09:35.

    #2
    You are using the wrong DOCTYPE; see FAQ.

    Comment


      #3
      You are right. Adding <!DOCTYPE html> to the begining of the html page solved the problem.

      Thanks a lot for the fast help!

      Comment

      Working...
      X