Announcement

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

    How to: hints, sections, etc via DataSource

    Our application is meant to be highly configurable and flexible - it is one of the main reasons we went with SmartGwt and we love it so far. We want as much of the end product to be configurable via xml as possible without requiring our integration teams to write code.

    Is there a way to do the following, and if not, is there a work-around that would allow such things?

    1) We have created Workflows for some of our more complicated entities. We split up DataSources into smaller chunks, put them on different pages of the Workflow and then use a ValuesManager to connect them. However, this means that you lose some of the automatic databinding that occurs. For instance, you must manually (via code) indicate which fields go on which page. I'm assuming there is no way to split up DataSource fields into sections via the xml so is there a simple / elegant way to do this as a work around?

    2) We would also like to have the ability to include field hints as a part of the ds.xml file. Is this possible?

    Thoughts?

    #2
    What I have proposed to do in the meantime (but haven't tried):

    1) Create separate ds.xml files for each "section" of a Workflow (Sect1, Sect2, etc). This solves the problem of automatically mapping the correct fields to the correct sections and pages, but then you lose the convenience of the ValuesManager in being able to treat all the separate DynamicForms as a single form (which requires them all to be from the same DataSource).

    2) Create a CustomDataSource (extended from the normal DataSource) that implements an interface for fetching field hints - very similar to the way localization works with a .properties file. Would require quite a bit of manual work to keep the changes in code in-synch with the changes in the .properties but at least our integration teams would have a central place to alter these if needed.

    Comment


      #3
      2) is the right general idea, except you don't need separate .properties files.

      You can add your own custom properties to <field> declarations and retrieve them client-side with DataSourceField.getAttribute(). So this would allow you to annotate fields with eg group="one", then have a subclass of DynamicForm that supports being given a fieldGroup property, and whirls through it's DataSource's fields to find fields that have been annotated with that group, then generates FormItems automatically and passes them to setItems().

      Comment

      Working...
      X