dankhan
11 Oct 2010, 1:06 AM
Hi,
Looked at a few examples but can't figure this one out.
I've got a button on each page of my carousel that shows an overlay with a scroller - I'm reusing the same overlay on cards. Upon loading the overlay I want to reset the position of the scrolled content back to the top since if i scrolled down a long page of content on a previous card, the next time I load the overlay with new content the position stays at the bottom.
The examples (e.g. twitter) imply I can use the [Panel].scroller.scrollTo({x: 0, y:0}) function, but when I call this on a global object, it says that [Panel].scroller is undefined. I've tried a few different routes around this including creating an Ext.util.Scroller object and referencing this, but still no good?
Here's my snippet
// Global
var overlay
// The overlay window
overlay = new Ext.Panel({
floating: true,
modal: true,
centered: true,
styleHtmlContent: true,
dockedItems: overlayTb,
scroll: 'vertical',
cls: 'overlaycontent'
});
...
// Callback to show the overlay on button click
var showOverlay = function(btn, event) {
overlay.update('content');
overlay.scroller.scrollTo({x:0,y:0}, false);
overlay.show();
};
Here's my safari error:
TypeError: Result of expression 'overlay.scroller' [undefined] is not an object.
Looked at a few examples but can't figure this one out.
I've got a button on each page of my carousel that shows an overlay with a scroller - I'm reusing the same overlay on cards. Upon loading the overlay I want to reset the position of the scrolled content back to the top since if i scrolled down a long page of content on a previous card, the next time I load the overlay with new content the position stays at the bottom.
The examples (e.g. twitter) imply I can use the [Panel].scroller.scrollTo({x: 0, y:0}) function, but when I call this on a global object, it says that [Panel].scroller is undefined. I've tried a few different routes around this including creating an Ext.util.Scroller object and referencing this, but still no good?
Here's my snippet
// Global
var overlay
// The overlay window
overlay = new Ext.Panel({
floating: true,
modal: true,
centered: true,
styleHtmlContent: true,
dockedItems: overlayTb,
scroll: 'vertical',
cls: 'overlaycontent'
});
...
// Callback to show the overlay on button click
var showOverlay = function(btn, event) {
overlay.update('content');
overlay.scroller.scrollTo({x:0,y:0}, false);
overlay.show();
};
Here's my safari error:
TypeError: Result of expression 'overlay.scroller' [undefined] is not an object.