可以參考iscroll
ref : http://www.rahulsingla.com/blog/2011/11/extjs-and-iscroll-scrolling-ext-containers-on-touch-devices-ipad-iphone-etc-using-iscro
ref : http://cubiq.org/iscroll-4
如果不想這樣麻煩,參考以下的code.
solution from here
=============================================
listeners: {
itemmousedown: function (view, rec, item, idx, event) {
var startX = event.getX();
var startY = event.getY();
var grid = view.up('gridpanel');
var div = grid.getEl();
var body = Ext.getBody();
body.setStyle('cursor', '-moz-grabbing'); //doesn't work in 4.0.7+
div.on('mousemove', function (e) {
x = e.getX(), y = e.getY()
grid.scrollByDeltaX(startX - x);
grid.scrollByDeltaY(startY - y);
startX = x
startY = y
});
body.on('mouseup', function (e) {
body.setStyle('cursor', 'default'); //doesn't work in 4.0.7+
div.removeAllListeners();
body.removeAllListeners();
});
body.on('mouseleave', function (e, tgt) {
body.setStyle('cursor', 'default'); //doesn't work in 4.0.7+
div.removeAllListeners();
body.removeAllListeners();
});
}
}
=======================================
加油了!!
沒有留言:
張貼留言