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.
Announcement
Collapse
No announcement yet.
X
-
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 });
Comment
-
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
-
If the first line in Canvas.setIsGroup would be commented out (but I'm sure it's there for optimization reasons), it will work.
Another way of fixing it is by creating this derived class (which is slightly cleaner than the previous example):Code:setIsGroup : function (isGroup) { if (isGroup == this.isGroup) return; // ... }
I think the cause of the problem is that setIsGroup() in Canvas is called to soon (it's called in init());Code:isc.defineClass('GroupedForm', isc.DynamicForm).addProperties({ padding: 5, init: function () { this.Super('init', arguments); this.setIsGroup(true); } });
Comment
Comment