PDA

View Full Version : Scroll gesture from button



EternalNinja0
5 Jun 2011, 12:52 AM
I recently found this code in another thread but it doesn't seem to work anymore. Can anybody help me get this working as I think it might be from an older release of Sencha Touch.



Ext.setup({
onReady: function(){
var html = [];
for(var i = 0; i < 1000; ++i){
html.push('row' + i);
}

function scroll(y){
console.log(y);
var scroller = p.scroller,
offsets = scroller.getOffset();
scroller.scrollTo({
x: offsets.x,
y: offsets.y + y
}, true);
}

var p = new Ext.Panel({
fullscreen: true,
scroll: 'vertical',
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
items: [{
text: 'Up',
handler: scroll.createDelegate(null, [-200], false)
},{
text: 'Down',
handler: scroll.createDelegate(null, [200], false)
}]
}],
html: html.join('<br />')
});
}
});