Announcement

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

    changing FormItem

    This has possibly been discussed over and over, but I can not get it to work, so...

    On a DynamicForm, I would like to change the form item used for some of the fields. (I want to replace them with a StaticTextItem to make it read-only.)
    By default, the form items are derived from the bound DS.

    Setting type (with FormItem.setType()) on fields returned by getFields() does not seem to do anything.

    Calling setEditorType() on the FormFields throws an exception.

    Manually re-creating all the changed FormItems, and then calling setFields() works, but causes ID collision problems later on. (See here: http://forums.smartclient.com/showthread.php?t=5430 )

    I do not want to touch the DataSourceFields, since the modifications I want to do are only relevant to the current DynamicForm,
    not all users of the DataSources.

    Which one is the right solution?

    #2
    setUseAllDataSourceFields does not seem to work on my DynamicList (user error)

    Because overriding the auto-generated FormItems seems to cause ID collisions, I have tried totally disabling the auto-generated fields (and generating them myself), but even if I call setUseAllDataSourceFields(false)
    before or after binding the DS, the default fields are still added.

    Is this intended?

    UPDATE: I realized that this setting only takes effect after setFields() is called, so enabling it does not mean that without setFields, I get no Fields.
    Last edited by csillag; 21 Feb 2010, 04:09.

    Comment


      #3
      Originally posted by csillag
      I do not want to touch the DataSourceFields, since the modifications I want to do are only relevant to the current DynamicForm,
      not all users of the DataSources.
      To get arount this, I have created a new DS, called setInheritFrom() on it to make it inherit from the original one, and then configured the DataSourceFields on it.

      However, modifying the field definitions seem to influence the original DS, too: if I do a getFields()[0].setHidden(true) on the descendant DS, the field is hidden in the ancestor DS, too.

      Is this intended? If yes, then how am I supposed to create a customized version of a DS?

      pl. Since this seems to be a new issue, I have re-posted it as a new thread here: http://forums.smartclient.com/showthread.php?t=9822
      Last edited by csillag; 21 Feb 2010, 03:23.

      Comment


        #4
        Solved

        Solved by avoiding the ID collision problem using useAllDataSourceFields.
        See http://forums.smartclient.com/showthread.php?t=5430

        Comment

        Working...
        X