imaffett / jqMobi-Plugins

Plugins for jqMobi
http://www.jqmobi.com
MIT License
24 stars 9 forks source link

Pull To Refresh on a Subpanel #10

Closed ThisThatBC closed 11 years ago

ThisThatBC commented 11 years ago

Hi,

I'm trying to get the pull to refresh functionality working on a subpanel. I have tried adding "refresh:true" to the scroller constructor in the subpanel module and also created a method to return the scroller and then explicitly calling addPullToRefresh();. No exceptions are thrown. The "refresh-trigger" event is NOT triggered. Is there some other constraint which would stop the pull to refresh from working. I'm suspecting it has to do with it only working with the parent page panel and not the div that encapsulates the subpanels.

Thanks Burak

imaffett commented 11 years ago

Do you have a sample I could check out?

ThisThatBC commented 11 years ago

Fortunately/unfortunately I haven't been able to reproduce the same results in the isolated test case. i.e. the pull to refresh works when I make a sample app. It's late here, I'll have a proper go tomorrow and figure out what the difference between them is.

ThisThatBC commented 11 years ago

The problem only occurs with the native scroller, the js scroller works. In the event handler, nativeScroller.prototype.onTouchMove() the following condition is never true

if(this.refresh && (this.el.scrollTop) < 0) {

which in turn never runs

this.showRefresh();

The problem is that this.el.scrollTop is always equal to zero. I've tried making the refresher container visible as this might cause the scrollTop property equal to zero but to no avail. The issue might be the extra layer of containers encapsulating the scrollers which are not moving.

I am using PhoneGap but I doubt that this is the problem as the pull to refresh works when not using subpanels.

Any help would be appreciated, but I suspect that it could involve substantial work.

I've listed the test page below:

<!DOCTYPE html>

Test ```
```
imaffett commented 11 years ago

Thanks - I'll try hunting this down. I was able to get it to "work" (getSubpanelScroller) looks to be a custom function you have), but for some reason it's not properly showing the box until after the refresh is triggered.

imaffett commented 11 years ago

Since you made changes, you should be able to just use the new CSS file. Tested in the browser and it now works fine.