nativescript-community / nativescript-community/ui-collectionview

How to get a specific item from the collection

Open
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
62
Forks
19
Avg merge
2d 15h
Merged PRs (30d)
2

Description

I want to know how I can get a specific item's view from the collection using index or some other way. @farfromrefug told me about getViewForItemAtIndex in #17 but haven't been able to make it work. I need to do some work on each item of the list when the user presses a button (not part of collection). Here's my code:

const collection = page.getViewById('collection');

for (var i = 0; i < listItems.length; i++) {
  const listItem = collection.getViewForItemAtIndex(i);
  console.log(listItem); // undefined
}

Since there's no documentation on it, I'm just shooting in the dark here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the getViewForItemAtIndex entry point and the related discussion in issue #17. Clarify how item views are obtained from a collection, including why the call may return undefined, and document a supported example for work triggered by an external button.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
mobile-dev
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.