Search code examples
dojodojox.mobile

Prevent scrolling in Dojo mobile app


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?


Solution

  • 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();
    }