Nativescript: [Feature Vote] Add Indexing for ListView, Repeater

Created on 18 Jan 2017  路  12Comments  路  Source: NativeScript/NativeScript

In order to expose the item index via binding, we can add it to list-view and repeater with adding

For repeater: after this line

dataItem["$index"] = i;   

For list-view: before this line

item["$index"] = index;

This way users will be able to have access to the index of the item in their list like

e.g.

<Repeater items="{{ items }}">
    <Repeater.itemsLayout>
        <StackLayout />
    </Repeater.itemsLayout>
    <Repeater.itemTemplate>
            <Label text="{{ $index }}" textWrap="true" />
    </Repeater.itemTemplate>
</Repeater>

However, this is another operation that will be added for each cell.
Please vote in this issue if we should add this feature or not.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

feature android ios

Most helpful comment

+1

was my vote correct?

All 12 comments

+1

was my vote correct?

+1

+1

+1

+1

+1

@NickIliev What's the use case of this feature? Isn't it responsibility of the view model to populate each data item with an additional index property when such is needed?

@atanasovg indeed each dev can provide index via the view-model (here) - I think a lot of the users are searching for this feature as out-of-the box indexing (similar to the one provided in Angular `let-i="index")

+1, all the time have to apply workarounds to get the index in list-view and repeater. This is must-have.

+1

+1

+1

Was this page helpful?
0 / 5 - 0 ratings