If a single logical form needs to be separated into multiple DynamicForm instances for Layout purposes (for example, spanning one logical form across multiple Tabs), a ValuesManager can be used to make the forms act as one logical form, supporting all value-related APIs otherwise called on DynamicForm directly.
A ValuesManager has no visual representation - it is strictly a logical entity, and the member forms provide the user interface. You can initialize a ValuesManager with a set of member forms (by setting {@link com.smartgwt.client.widgets.form.ValuesManager#getMembers members} at init) or add and remove member formsdynamically.
Calling {@link com.smartgwt.client.widgets.form.ValuesManager#setValues ValuesManager.setValues} on aValuesManager will automatically route new field values to whichever member form is showing an editor for that field. Likewise, calling {@link com.smartgwt.client.widgets.form.ValuesManager#validate ValuesManager.validate} will validateall member forms, and {@link com.smartgwt.client.widgets.form.ValuesManager#saveData ValuesManager.saveData} willinitiate a save operation which aggregates values from all member forms.
Like a DynamicForm, a ValuesManager can be databound by setting {@link com.smartgwt.client.widgets.form.ValuesManager#getDataSource dataSource}. In this case all member forms must also be bound to the same DataSource.
In general, when working with a ValuesManager and its member forms, call APIs on the ValuesManager whenever you are dealing with values that span multiple forms, and only call APIs on member forms that are specific to that form or its fields.
Note that, just as a DynamicForm can track values that are not shown in any FormItem, a ValuesManager may track values for which there is no FormItem in any member form. However, when using a ValuesManager these extra values are only allowed on the ValuesManager itself. Member forms will not track values for which they do not have FormItems.
|
|
|
|