سؤال

I'm implementing dragging and dropping of list items in a Dojo mobile app. I use dojo.gesture.tap.hold to initiate the dragging. However, the page scrolls when you start dragging.

The list is inside a ScrollableView.

Is there a way to deactivate scrolling while dragging?

هل كانت مفيدة؟

المحلول

Sigh, I found the answer. Get a hold on the ScrollableView, override the onBeforeScroll event handler and return a boolean to indicate whether the view should scroll or not.

Example:

var scrollView = dijit.registry.byId("myScrollableView");
scrollView.onBeforeSCroll = function(evt) {
  return shouldTheViewScroll();
}

نصائح أخرى

You can also set the disableTouchScroll attribute of the ScrollableView to true/false as needed. This is not documented (and yes that should be fixed), but it should work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top