PDA

View Full Version : scrollTo



hitman01
21 Oct 2010, 12:08 PM
I have a scrollable panel in which I have a large image (images changes dynamically) that can take up a lot of space. I would like to scrollTo the middle of that image. However, the scrollTo function has no effect. Can anyone help.

Here is the code for the panel.

var zoomPanel = new Ext.Panel({
fullscreen: true,
scroll:'both',
centered: true,
style: "text-align: center;",
html: "<img id='zoomImage' src='someimage.jpg'/>",
})

hitman01
22 Oct 2010, 5:40 AM
got it working using Panel.scroller._scrollTo().

Michou
29 Oct 2010, 12:50 AM
Yes, but in 0.98 it seems that there is no _scrollTo()...:((

In 0.97, for example:

<li class="bas" onclick="toggleNext(Ext.get(this));">title</li>';
<li class="hidden">hidden text</li>';

toggleNext = function (o) {
n = Ext.getDom(o.id).nextSibling;
n = Ext.get(n);
s = Ext.get(o).getScrollParent();
if (o.hasClass('bas')) {
o.removeClass('bas').addClass('haut');
n.removeClass('hidden');
s._scrollTo({ x: 0, y: -o.dom.offsetTop });
} else {
o.removeClass('haut').addClass('bas');
n.addClass('hidden');
}
}and if i replace _scrollTo with scrollTo : no effect

hitman01
29 Oct 2010, 5:29 AM
I've changed my code a bit. I'm now using the regular scrollTo however, it works for me only after the panel is rendered. So I do panel.show(); and than scrollTo (using floating modal panel)

Michou
29 Oct 2010, 6:41 AM
I understand my mistake :
with _scrollTo my offset point was placed at the top of the panel for wathever total height of the page you want to scroll.
with scrollTo the scrolling is only visible if your page is heigher than its container...

but you need a panel.doLayout() or a panel.doComponentLayout()...