kmc
kmc

Reputation: 658

How can I keep a Sencha Touch 2 dataview scrollable but turn off scrolling behaviour?

I would like to keep the dataview scrollable so that I can use the scrollBy and scrollTo functions, but I don't want the user to be able to swipe to scroll the dataview. But I still need to respond to the swipe gesture.

I was thinking that maybe adjusting the momentumEasing values could do it. But I'm having trouble getting my changes to be used by the scroller. In my dataview config I have the following code, but it changes nothing about the scroller behaviour:

scrollable: {
      momentumEasing: {
        momentum: {
          acceleration: 0,
          friction: 999999
        },
        bounce: {
          acceleration: 0,
          springTension: 0
        }
      }
    }

Any ideas why this doesn't work? Alternatively, are there any other, cleaner ways to acheive what I'm after? I also will need to remove the scollbar from appearing, but I assume that can be done with CSS?

Thanks.

Upvotes: 1

Views: 1818

Answers (1)

rdougan
rdougan

Reputation: 7225

You just need to override the onDragStart method in your scroller so it does nothing.

container.getScrollable().getScroller().onDragStart = null;

Upvotes: 2

Related Questions