PDA

View Full Version : synchronize the scroll percent on locked and unlocked part



aj3423
23 Dec 2010, 12:00 AM
try the locking grid demo, the grid won't scroll when mouse wheel in the locking side.
is it possible for the locking part receive mouse wheel event and make grid scroll?
i tried
grid.view.on('mousewheel', function() {
console.info(arguments);
});

it works, but i couldn't find 'mousewheel' event in API, is it a hidden event? i'm using Ext3.2.0, and the arguments seems useless, the wheel direction could be found: e.getSrollDelta(), but not much information about scroll position.

anyway to scroll the grid on mousewheel?

Thanks.

Condor
23 Dec 2010, 12:41 AM
You can't attach a mousewheel event to the view, but you could attach it to grid.getView().lockedScroller.

Also, there is no getSrollDelta method in EventObject, you are looking for e.getWheelDelta().

aj3423
23 Dec 2010, 12:48 AM
this is piece of my code:

this.lockedScroller.on("mousewheel", this.handleWheel, this);

handleWheel: function(e) {
// console.info(e);
console.info(e.getWheelDelta());
},

the value of e.getWheelDelta() is either 1 or -1, it just indicates the direction? but how many pixel should be scrolled?

Condor
23 Dec 2010, 1:13 AM
Mousewheel events don't count in pixels. They count in scrollwheel 'stops' and the OS interprets this as an amount of pixels to scroll (but you don't have access to that value in the browser).