Announcement

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

    Problems with ValuesManager.setvalues

    Isomorphic,

    I'm trying to implement a mechanism where the UI (consisting of multiple forms bound by ValuesManager) state need to be saved in a database and then restored when necessary. I store the values as String in the database. I store 'true' or 'false' for CheckBoxItem. But when I pass the Map as is with strings to ValuesManager.setValues(map), checkboxitems are not set as expected. I tried overriding setValue(..) all possible combinations for ValuesManager,DynamicForm, FormItem..nothing seems to work. How do I achieve this?

    Also another observation, I have a valuesmanager set on VLayout (which manages some forms in the layout). When I invoke getMembers() on the VLayout.getValuesManger() it throws an exception that ClassCastException: VLayout cannot be cast to DynamicForm. I'm not casting anything here, internally getMembers on a valuesmanager defined on a layout throws this exception.Is this a bug?

    Thanks.

    #2
    Add the forms to the ValuesManager not the layout containing the forms.

    Why are you persisting Booleans as Strings? If this is truly the behavior you want in the DB, then convert the Boolean values to/from Strings in DMI. This seems entirely unnecessary though.

    Comment


      #3
      jpappalardo is correct, if you're going to serialize data, you need to preserve types such as booleans (also Dates).

      You would not normally call setValuesManager() on a VLayout except with a very advanced use case involving dataPath, which is probably not what you're doing here. A ValuesManager is a non-visual component, and you do not need to associate it with a layout for it to be able to manage a set of forms contained by that Layout.

      Comment

      Working...
      X