Announcement

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

    Multiple columns form

    Hello,

    I'm currently working on a SmartGWT prototype, and I am looking for a way to create multi-columns forms.

    It seems that you can do 2-columns form by changing titleOrientation's form (http://www.smartclient.com/smartgwt/showcase/#layout_form_databinding), but I would like to create n-columns forms. Is there a way to do that ?

    Good job by the way, I really appreciated what you did for enterprise-application's workers :)

    #2
    We have most of the SmartClient API docs covered in the SmartGWT javadocs but there is still a little catchup that is needed. Will continue updating the docs / javadocs and hopefully by the next release we are current.

    Please have a look at this document that describes how you can have complete control over the number of columns in the form, and how individual FormItem's are laid out. The docs for SmartClient pretty much translate 1-1 for SmartGWT.

    http://www.smartclient.com/docs/6.5....up..formLayout

    So in short, you set the number of columns on the DynamicForm instance. For example if you want 3 sets of text fields with their labels displayed one one row you can call :

    Code:
    dynamicForm.setNumCols(6);
    We set it to 6, and not 3 because as noted in the doc above, the label of the field is also considered as a column. So now if you add 4 TextItems to the form, three of them will appear on the first line, and the fourth will go to the second line.

    You can further control the widths of the columns in the DynamicForm by calling setColWidths. For example in a form with 3 columns you can call

    Code:
    dynamicForm.setColWidths(60, 100, "*");
    Have a look at this sample :

    http://www.smartclient.com/smartgwt/..._form_spanning

    Click the "View Source" button and examine how the code sets the colWidths to (60, "*"). In this sample, the "Subject" label sits in the first column of the form and is 60px wide. And the second column is setup to take the rest of the width. Now resize the form in the sample and see how the label column continues to be 60px wide while the text are widens.

    Hope this clarifies.

    Sanjiv

    Comment


      #3
      This definitely clarifies !

      Thanks a lot Sanjiv
      Tanguy

      Comment

      Working...
      X