Stefan Kendall
Stefan Kendall

Reputation: 67832

Prevent scrolling up beyond a certain point in a sencha touch panel?

Is there a way I can prevent scrolling up beyond a certain point in sencha touch? I have a panel that overflows vertically, but I don't want the user to be able to pull the content down (scroll up) to put vertical whitespace between the docked titlebar and the first bit of content.

How can I achieve this?

Upvotes: 0

Views: 540

Answers (1)

stan229
stan229

Reputation: 2607

What you would do is add a listener to the scroller of the panel. The scroller can be referenced by the scroller property of the panel.

Something like this. You'd have to play with it a bit but I think this should work. Code is untested.

  panel.scroller.addListener({
    'offsetchange': function (draggable, offset) {
        if (offset.y == 0) {
            panel.scroller.scrollTo({
                x: 0,
                y: 0
            });
        }
    }
});

Upvotes: 2

Related Questions