PDA

View Full Version : Strange Scroller.setOffset() behavior



stenlik
7 Dec 2010, 9:02 AM
Hi,

I am listening on my ext.Panel for its Scroller 'scroll' event. When the panel is moving horizontally (to the left, so offset is increasing) I am checking the offset value. Once the scroller offset is bigger then some defined value I want to move the Scroller (and consequently the Panel) back, but after I call setOffset() method with the proper negative offset value, the moving direction from some reason changes to the opposite one (left to right and vice versa). Does anybody knows why???


scroll: function(cp, offset)
{
if ( offset.x >= 160*13 )
{


var new_offset = new Ext.util.Offset();
var change_change = -160*13 + offset.x;
new_offset.x = -160*13 + change_change ;
categoriesPanel.scroller.setOffset( new_offset, false );

}
}Thanks a lot for help
BR
STeN

pcr
25 Feb 2011, 8:33 AM
categoriesPanel.scroller.setOffset( new_offset, false ) has to be
categoriesPanel.scroller.setOffset( dir, new_offset, false )
where dir = 'left', 'right', 'top' or 'bootom'