PDA

View Full Version : How do you adjust scrollLeft of a Panel?



worthlutz
23 Feb 2012, 11:01 AM
I put a set of map images in a panel which is smaller that the images and has autoscroll on. I can scroll and see the map but when the panel resizes I want to adjust the scrollLeft by one-half the amount of the size change so the map stays centered.

How do I adjust the scrollLeft of the panel?

Thanks,
Worth

mitchellsimoens
23 Feb 2012, 12:35 PM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Element-method-scrollTo

Use scrollTo on the panel's body element.

worthlutz
23 Feb 2012, 4:37 PM
I'm new to Ext and coming from Prototype. How do I get the Panel's (or any component's) body element? I see no method under Panel. Do I need to look up the class ancestral chain for a method or are they all listed for each class?Once I get the element, is this the Dom element where I can find the existing scroll values for determining what to scrollTo?As you can see I am still trying to figure out all the documentation. Not everything is obvious.Yet, I still reading!I like the way Ext takes most of the layout off my back. I still have not figured out how to get my map images under control. I'll explain it a bit and maybe someone can help point me in the best direction. I have a horizontal panel with the mapviewport in the center. The two outer panels are collapsible allowing a wide view of the map. When these panels are collapsed, the map is seen in its entirety. When a panel is opened to view some text or something, the map is viewed through a smaller opening and there is a scroll bar across the bottom.Given this description, when the browser window is resized, I want to be able to resize the map images retrieved from the server to fit the new size of the mapviewport at its largest (both side panels collapsed) . Is this information readily available in Ext or should I name the appropriate element and use the tools from Prototype to get the layout information I need?:-/

friend
24 Feb 2012, 5:07 AM
You can get any component's body Element, assuming that the component has already been rendered, in one of two ways:



var bodyElement = someComponent.el;


or



var bodyElement = someComponent.getEl();

mitchellsimoens
24 Feb 2012, 5:08 AM
You can get any component's body Element, assuming that the component has already been rendered, in one of two ways:



var bodyElement = someComponent.el;


or



var bodyElement = someComponent.getEl();


For panel it is panel.body not panel.el.