Jump to content

How to detect bottom end scroll on TunimDBListGrid ?


KingOrmon

Recommended Posts

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

  • 2 weeks later...

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

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

  • 3 weeks later...
  • 2 weeks later...

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

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

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

  • 2 weeks later...
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

  • 2 weeks later...
×
×
  • Create New...