KingOrmon Posted November 7, 2020 Share Posted November 7, 2020 Hello, I would like to detect via JS when user scroll to the end of list. (when list bounces beceause no more data) Any idea ? Link to comment Share on other sites More sharing options...
Sherzod Posted November 7, 2020 Share Posted November 7, 2020 Hello, 2 hours ago, KingOrmon said: I would like to detect via JS when user scroll to the end of list. (when list bounces beceause no more data) function afterCreate(sender) { let scroller = sender.getScrollable(); if (scroller) { scroller.on('scrollend', function(a, b, c) { if (scroller.getMaxPosition().y == c) { //ajaxRequest alert('end') } }) } } Link to comment Share on other sites More sharing options...
KingOrmon Posted November 9, 2020 Author Share Posted November 9, 2020 Works perfect!, thank you Link to comment Share on other sites More sharing options...
KingOrmon Posted November 18, 2020 Author Share Posted November 18, 2020 How can I scroll to end a TunimDBListGrid ? function afterCreate(sender) { let scroller = sender.getScrollable(); if (scroller) { scroller.on('scrollend', function(a, b, c) { if (scroller.getMaxPosition().y == c) { ajaxRequest(sender, 'getProducts', []); // get product list scroller.scrollTo(0, 10000000, []); //it does nothing } }) } } Link to comment Share on other sites More sharing options...
Sherzod Posted November 18, 2020 Share Posted November 18, 2020 6 hours ago, KingOrmon said: How can I scroll to end a TunimDBListGrid ? Hello, Try this approach: 1. function afterCreate(sender) { let me = sender; me.scrollToEnd = function() { me.select(me.getStore().last(), true); me.ensureVisible(me.getStore().last()) } } 2. Usage procedure TMainmForm.UnimButton1Click(Sender: TObject); begin with UnimDBListGrid1.JSInterface do JSCall('scrollToEnd', []) end; Link to comment Share on other sites More sharing options...
KingOrmon Posted November 18, 2020 Author Share Posted November 18, 2020 Thank you! Link to comment Share on other sites More sharing options...
KingOrmon Posted December 9, 2020 Author Share Posted December 9, 2020 Hi, I have noticed that scrollend event not firing on Android devices using chrome. Any idea ? Link to comment Share on other sites More sharing options...
KingOrmon Posted December 18, 2020 Author Share Posted December 18, 2020 @Sherzod Hi, I have noticed that scrollend event not firing on Android devices using chrome. Any idea ? Link to comment Share on other sites More sharing options...
Sherzod Posted December 18, 2020 Share Posted December 18, 2020 Just now, KingOrmon said: I have noticed that scrollend event not firing on Android devices using chrome. Hi, I will check. Link to comment Share on other sites More sharing options...
Sherzod Posted December 18, 2020 Share Posted December 18, 2020 4 minutes ago, KingOrmon said: I have noticed that scrollend event not firing on Android devices using chrome. Can you make a simple testcase for this? Link to comment Share on other sites More sharing options...
KingOrmon Posted December 18, 2020 Author Share Posted December 18, 2020 Nothing special, Place a UnimDBListGrid1 and add event: function afterCreate(sender) { let scroller = sender.getScrollable(); if (scroller) { scroller.on('scrollend', function(a, b, c) { if (scroller.getMaxPosition().y == c) { var store = sender.getStore(); console.log(store.count()); if ( store.count() % 100 == 0 ) ajaxRequest(sender, 'zAjaxScrollEnd', []); console.log(store.count() % 100); } }) } } Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2020 Share Posted December 19, 2020 22 hours ago, KingOrmon said: if ( store.count() % 100 == 0 ) ajaxRequest(sender, 'zAjaxScrollEnd', []); Can you check the condition again!? Link to comment Share on other sites More sharing options...
KingOrmon Posted December 21, 2020 Author Share Posted December 21, 2020 The problem is that scrollend not fires under redmi 9 chrome, on iphone and web works well Link to comment Share on other sites More sharing options...
Sherzod Posted December 21, 2020 Share Posted December 21, 2020 2 hours ago, KingOrmon said: The problem is that scrollend not fires under redmi 9 chrome, on iphone and web works well Hello, Could you please create a test case? Although I have already tested on mobile devices (android) and it works... Link to comment Share on other sites More sharing options...
KingOrmon Posted December 21, 2020 Author Share Posted December 21, 2020 Reviewing it I see that this condition never happens on android if (scroller.getMaxPosition().y == c) using console log I get values like this: scroller.getMaxPosition().y = 4295 c = 4294.9032344 Is it normal ? Link to comment Share on other sites More sharing options...
Sherzod Posted December 21, 2020 Share Posted December 21, 2020 6 minutes ago, KingOrmon said: Reviewing it I see that this condition never happens on android if (scroller.getMaxPosition().y == c) using console log I get values like this: scroller.getMaxPosition().y = 4295 c = 4294.9032344 Is it normal ? Please make a simple testcase. 7 minutes ago, KingOrmon said: Reviewing it I see that this condition never happens on android How do you test this? Link to comment Share on other sites More sharing options...
KingOrmon Posted December 21, 2020 Author Share Posted December 21, 2020 Using chrome > remote devices > inspect Link to comment Share on other sites More sharing options...
Sherzod Posted January 1, 2021 Share Posted January 1, 2021 On 12/21/2020 at 4:06 PM, KingOrmon said: Reviewing it I see that this condition never happens on android if (scroller.getMaxPosition().y == c) using console log I get values like this: scroller.getMaxPosition().y = 4295 c = 4294.9032344 Is it normal ? Hello, Please make a complete test case to check. Link to comment Share on other sites More sharing options...
KingOrmon Posted January 4, 2021 Author Share Posted January 4, 2021 I attach a modified fish demo. FishFact (DBListGrid).zip Link to comment Share on other sites More sharing options...
Sherzod Posted January 4, 2021 Share Posted January 4, 2021 1 hour ago, KingOrmon said: I attach a modified fish demo. FishFact (DBListGrid).zip 12.64 kB · 0 downloads Hello, OK, and what doesn't work here? Link to comment Share on other sites More sharing options...
KingOrmon Posted January 14, 2021 Author Share Posted January 14, 2021 Hello The problem is that scrollend not fires under android device redmi 9 chrome, on iphone and web works well Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2021 Share Posted January 14, 2021 43 minutes ago, KingOrmon said: The problem is that scrollend not fires under android device redmi 9 chrome Hi, Dear forum Users. Could you also test? Link to comment Share on other sites More sharing options...
Recommended Posts