Announcement

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

    Colspan and * width

    Hi,

    I cannot set a formitem to use the whole dynamicform width in the following example:

    Code:
    DynamicForm form = new DynamicForm();
    		form.setNumCols(4);
    		TextItem item1 = new TextItem("ITEM1", "Item 1");
    		TextItem item2 = new TextItem("ITEM2", "Item 3");
    		TextAreaItem item3 = new TextAreaItem("ITEM3", "Item 3");
    		item3.setWidth("*");
    		item3.setColSpan(3);
    		form.setItems(item1, item2, item3);
    		form.setBackgroundColor("white");
    		form.setBorder("solid 1px black");
    		form.draw();
    You will see that, though the item3 TD is correctly spanning both columns, the width of the text area item does not use the whole space, though I've set its width to *

    Thanks for your help,

    Thomas

    (We are using SmartGWT 4.0p)

    #2
    Setting "*" for both width and colSpan should do what you want

    Comment


      #3
      Thanks you.

      Still the same problem, unfortunately.
      Here is the modified test case:

      Code:
      DynamicForm form = new DynamicForm();
      form.setNumCols(4);
      TextItem item1 = new TextItem("ITEM1", "Item 1");
      TextItem item2 = new TextItem("ITEM2", "Item 3");
      TextAreaItem item3 = new TextAreaItem("ITEM3", "Item 3");
      item3.setWidth("*");
      item3.setColSpan("*");
      form.setItems(item1, item2, item3);
      form.setBackgroundColor("white");
      form.setBorder("solid 1px black");
      I also attached the resulting form screenshot.
      Attached Files

      Comment


        #4
        We'll look at whether something might be amiss in the sizing logic, but you can give the form a width, or put it into a layout with a width

        Comment


          #5
          Ok, if I put a fixed size to my form, it's working as expected.
          Perhaps this should be added to the docs?
          Additionally, it would be nice if the setwidth("*") also worked when the form is in a Layout with setWidth100()

          Meny thanks for your quick help,

          Thomas

          Comment


            #6
            What's happening in your test case is that the form ends up with the default width of 100, and the TextItems, which have fixed 150px size, cause this width to be overflowed.

            The width:"*" item is sized according to the original width of the overall form (100), not its overflowed size. This is correct behavior.

            To avoid the result you didn't want, just set the form to a reasonable width that accommodates your form items (the width of 100 clearly does not). Typically, an appropriate width is arrived at automatically without the need for a setting, because the form is embedded in some kind of larger layout, and the default is to have children fill the breadth of the layout.

            Comment

            Working...
            X