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

How to get a specific item from the collection #37

Open
Whip opened this issue Dec 18, 2021 · 0 comments
Open

How to get a specific item from the collection #37

Whip opened this issue Dec 18, 2021 · 0 comments

Comments

@Whip
Copy link

Whip commented Dec 18, 2021

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.

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