Announcement

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

    Are legends possible in a DynamicForm?

    I want to group some fields in a DynamicForm. I have found a way of doing this by creating a ValueManager and defining several small forms that all point to the same ValueManager instance. This works, but I wonder if this is the best way. I know I can also use sections, but this is not giving me the desired look and feel.

    #2
    Check out http://www.smartclient.com/docs/10.0/a/b/c/go.html#attr..Canvas.isGroup

    This will print a group line around the layout and print the grouptitle of the canvas.

    Comment


      #3
      I use the isGroup and groupTitle options, but that means I need to split the form in multiple pieces. Not a disaster, but I wonder if there's an simpler approach.

      Comment


        #4
        use ValuesManager

        I found an old thread with kind of the same problem: http://forums.smartclient.com/archive/index.php/t-14738.html

        Seems like "ValuesManager" is what you are looking for.

        Comment


          #5
          I am indeed using the ValuesManager and define several forms and this works, but it is quite some extra lines to add, because for all these forms I need to set { isGroup: true, padding: 5 }. I've tried creating an GroupedForm class deriving from DynamicForm and only adding these two properties, but somehow this doesn't work. At least I am not seeing a border around the form.

          Code:
              isc.defineClass('GroupedForm', isc.DynamicForm).addProperties({
                  isGroup: true,
                  padding: 5
              });
          Last edited by wallytax; 25 Mar 2015, 01:24. Reason: Added example

          Comment


            #6
            Via another post, I found out that this will work, but I think that's not nice. One should be able to derive from a (Canvas) class and set isGroup to true without the need to manually set the border and group title.

            Code:
                isc.defineClass('GroupedForm', isc.DynamicForm).addProperties({
                    isGroup: true,
                    padding: 5,
            
                    initWidget: function () {
                        this.setBorder(this.groupBorderCSS);
                        this.setGroupTitle(this.groupTitle);
                        this.Super('initWidget', arguments);
                    }
                });

            Comment


              #7
              If the first line in Canvas.setIsGroup would be commented out (but I'm sure it's there for optimization reasons), it will work.

              Code:
              setIsGroup : function (isGroup) {
                  if (isGroup == this.isGroup) return;
                  // ...
              }
              Another way of fixing it is by creating this derived class (which is slightly cleaner than the previous example):

              Code:
                  isc.defineClass('GroupedForm', isc.DynamicForm).addProperties({
                      padding: 5,
              
                      init: function () {
                          this.Super('init', arguments);
                          this.setIsGroup(true);
                      }
                  });
              I think the cause of the problem is that setIsGroup() in Canvas is called to soon (it's called in init());

              Comment


                #8
                There was a bug in Canvas.init() with this line of code: delete this.isGroup, which was solved.
                The fix will be available as of tomorrow's build.

                Isomorphic Software

                Comment


                  #9
                  That's great news! Thanks for the fast response (and fix). I will check tomorrow's build (because of different time zones, it's not fully clear what "tomorrow" is, but I just checked the latest build and I didn't see any differences).

                  Comment

                  Working...
                  X