Topener / nl.fokkezb.pullToRefresh

Widget to implement a table pull-to-refresh header in Titanium Alloy
184 stars 60 forks source link

Is it possible to disable the pull to refresh? #60

Closed icecandy closed 8 years ago

icecandy commented 8 years ago

I am trying to work out a method to disable the pull-to-refresh. So one sets it up and uses it and at a later date one wants to disable it. On Android this mainly means that the pull down spinner does not show. All other functionality of the embedded ListView, say, to carry on. Is this possible?

FokkeZB commented 8 years ago

Though not documented, it seems that the Android module this widget uses has a enable/disable method.

But, currently the widget doesn't expose the instance of the module for you to call this method. I'll do an update to do that so you can try.

icecandy commented 8 years ago

That would be fantastic Fokke.

FokkeZB commented 8 years ago

I just published. You can now do:

$.ptrWidget.getControl().setEnabled(false);
icecandy commented 8 years ago

Hi Fokke. Thanks for pointing out the setEnabled function. I did have a look at the Java but didn't see that, but maybe was looking at the wrong fork ie not the most up to date.

FokkeZB commented 8 years ago

I found it here:

https://github.com/iskugor/Ti.SwipeRefreshLayout/blob/master/src/com/rkam/swiperefreshlayout/SwipeRefresh.java#L98

Did it work?

icecandy commented 8 years ago

I haven't downloaded your updated widget as I have may own modifications already. But the exposed setEnabled definitely works on Android so that's great and thanks for the pointer. On iOS one can disable by assigning list.refreshControl = null. Plus also removing events.

FokkeZB commented 8 years ago

OK, closing as fixed then. Thanks!