Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadMoreItems is called on ListViews items initialization #46

Closed
enchev opened this issue Apr 24, 2015 · 9 comments
Closed

loadMoreItems is called on ListViews items initialization #46

enchev opened this issue Apr 24, 2015 · 9 comments

Comments

@enchev
Copy link
Contributor

enchev commented Apr 24, 2015

From @qpautrat on April 20, 2015 9:6

Hi there,

Considering following code:

exports.pageLoaded = function(args) {
    console.log("pageLoaded");

    var page = args.object;

    page.bindingContext = {'items':[{'name':'Foo'},{'name':'Bar'}]};
};

exports.loadMoreItems = function(data) {
    console.log("loadMoreItems");
}

and this view:

<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
    <ListView items="{{ items }}" loadMoreItems="loadMoreItems">
        <ListView.itemTemplate>
            <Label text="{{ name }}" />
        </ListView.itemTemplate>
    </ListView>
</Page>

I get:

Apr 20 09:49:28: /app/test.js:3:16: CONSOLE LOG pageLoaded
Apr 20 09:49:28: /app/test.js:11:16: CONSOLE LOG loadMoreItems

However if my items is empty loadMoreItems is not called like it should be.

Copied from original issue: NativeScript/cross-platform-modules#294

@enchev
Copy link
Contributor Author

enchev commented Apr 24, 2015

Generally loadMoreItems will be called when you scroll ListView to the bottom and when you do not have items you do not have scroll as well.

@enchev
Copy link
Contributor Author

enchev commented Apr 24, 2015

From @qpautrat on April 21, 2015 7:3

Hi @enchev,

I was not specific enough my bad. This happen when i do nothing, no scroll.

@enchev enchev closed this as completed May 18, 2015
@Epotignano
Copy link

+1 for this problem

@JuanDelgadillo
Copy link

+1 Any solution for this problem?

@NickIliev
Copy link
Contributor

Hey @JuanDelgadillo

In case you do not have initial items loaded you won't need loadMoreItem event. Instead just initialize your initial items collection.

@tylerdoll
Copy link

Did anyone come up with a viable solution for this? I am experiencing this issue too when I dynamically load in items. It loads <=10 items on the first go, then for what ever reason it loads more even though I did not scroll and am not anywhere near the bottom of the ListView.

I'm taking a stab in the dark here but maybe it's an issue with the rendering of the list? Meaning if it renders each item one by one (which I don't know if it does), I guess at one point it would think it's near the bottom when the first one or two items are loaded?

@alexziskind1
Copy link

I confirmed that this is still an issue. If you have a very large array that you're loading from a service using paging (adding 10 items at a time and adding to the existing list on the client side), loadMoreItems is called continuously.

@mzaka
Copy link

mzaka commented Sep 20, 2018

+1,

LoadMoreItems runs automatically whenever items are initiated. Which should not be the behaviour.

SvetoslavTsenov pushed a commit that referenced this issue Mar 20, 2019
@lock
Copy link

lock bot commented Sep 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants