Announcement

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

    100% width for TextItem in a DynamicForm

    Hello,

    I need to set a TextItem's text box to fill all available width (100%). The following does not work:

    textItem.setWidth("100%");

    No width at all is then applied to the text box in the resulting HTML. The same result with the following which won't work either and have the same effect:

    textItem.setWidth("50%");
    textItem.setWidth("*");

    Setting a pixel-based width works, but this is not what I need:

    textItem.setWidth(120);

    I can set the width using CSS:

    textItem.setTextBoxStyle("box");

    .box {
    width:100%;
    }

    But then the original SmartGWT style is overwritten and all other formatting is lost.

    Can anyone help me out?
    Last edited by jballh; 24 Mar 2009, 03:26.

    #2
    Take a look at the Form Layout topic from SmartClient. Note the sticky thread about various SmartClient docs that make sense to use with SmartGWT - this is one of them.

    Comment


      #3
      Problem solved

      Hello,

      I had the same problem:
      I had a DynamicForm and the items were not aligned well. I was not able to set the width in the java code to 100% like jballh. So I added width:100%; to the css style of the items, but this value was overwritten.

      The solution is to set the width "null":
      Code:
      textItem.setWidth(null);
      Now the css style width settings will not be touched.

      Comment


        #4
        I can't belive I fell into this trap +10 years later :o. I had to read the referenced docs again. DynamicForms use a two column mode by default (one for the title ad one for the input control). So, the solution was very simple in our case, just `setColSpan(2);`. I had a SelectItem with setTitleOrientation(TitleOrientation.TOP).

        Comment

        Working...
        X