View Full Version : [4.1.1] Adding radiofields dynamically

5 Feb 2013, 12:53 PM
I've got three fieldsets in a form. Choosing radiofields out of the first two fieldsets determines the radiofields in the third and removes all fields from fieldset 3 and re-populates it with the correct set (again, based on the selections in the first two fieldsets).

When I scroll down the page and choose the first and second set of radios the third fieldset is populated and resized accordingly. When that happens the page scrolls to the top.

I'm not familar with a config that manages the scrolling when components are added/removed from a layout.

5 Feb 2013, 12:59 PM
not sure if this is what you talking about but...
try adding a

flex: 1,
autoscroll: true

to the container and this should take care of the resizing.

5 Feb 2013, 1:16 PM
The resizing works well already and the scroll is managed by the formpanel hosting the fieldsets.

Not sure what triggers the form to scroll-to-top when items are added to a fieldset.

6 Feb 2013, 6:24 AM
one more crack at it...
did you try overflowY?

6 Feb 2013, 9:41 AM
Found the answer.
Anytime I hid elements or added/removed elements within the form the scrollbar would bounce to the top of the form. The solution was to use element's cacheScrollValues (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.dom.Element-method-cacheScrollValues) method.

I cache the scrolling, add/remove/hide/show elements, and then restore the scrolling afterwards.

var restoreScroll = form.el.cacheScrollValues();
form.myRadioGroup.add([{boxLabel: 'foo'}]);