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

Odd loading issue with ListViews in iOS and latest SDKs (6-7) #65

Open
sschueller opened this issue May 20, 2018 · 1 comment
Open

Odd loading issue with ListViews in iOS and latest SDKs (6-7) #65

sschueller opened this issue May 20, 2018 · 1 comment

Comments

@sschueller
Copy link
Contributor

sschueller commented May 20, 2018

I am running into an issue which I can't explain. When the list reaches the end myLoader is called however the listview is not updated. When I tap on load more the listview is updated with new data and the data from the previous scroll trigger is also added. If I trigger the myloader manually(for example from a button somewhere else) it always works.

Notice the log output which will state which items are being added.

I am not using a collection here to simplify my example, however I have the same issue in my project which uses collections and sql queries.

It might be an SDK issue with listviews however I don't understand why it works fine if I trigger the myloader via button but not via scroll.

I have the following code:

index.js

var iter = 0;
var addpercall = 50;

$.index.open();
$.is.init($.list);
$.is.load();

function myLoader(e) {

    console.log('load more start: ', iter);

    var section = Ti.UI.createListSection();
    var items = [];

    for (var i = 0; i < addpercall; i++) {
        iter++;
        items.push({
                properties: {
                    itemId: 1
                },
                template: 'listRow',
                name: {
                    text: 'text ' + iter
                }
            }
        );
    }


    section.setItems(items);

    $.list.appendSection(section);
    e.success();


    console.log('load more end: ', iter);

}

index.xml

<Alloy>
    <Window class="container">

        <ListView id="list" defaultItemTemplate="listRow">
            <Templates>
                <ItemTemplate name="listRow" id="listRow" height="44">
                    <View>
                        <View>
                            <Label id="name" bindId="name"/>
                        </View>
                    </View>
                </ItemTemplate>
            </Templates>
            <Widget id="is" src="nl.fokkezb.infiniteScroll" onEnd="myLoader"/>
        </ListView>

    </Window>
</Alloy>

This issue also causes me to run into "[ERROR] message = "attempt to insert section 4 but there are only 2 sections after the update";".

@sschueller
Copy link
Contributor Author

Not setting a new section for each page works. So doing something like this: $.listSection.appendItems(items);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant