[ListView.DataSource] Comprehensive documentation & Sorting/Grouping
See original GitHub issueI was trying to understand how to work with ListView.DataSource
;
one of the key use case that I was interested in is sorting; my list is a collection of names, grouped by first letter:
A:
Adam,
Amy,
B:
Ben,
Bob
...
where should the sorting and grouping logic be? assuming I want to keep the list sorted and be able to add/remove rows.
the docs offered very little guidance: http://facebook.github.io/react-native/docs/listview.html#datasource
aside from the code example: http://facebook.github.io/react-native/docs/listview.html#examples
there was nothing really in the docs about the ListView.DataSource
.
the only thing close to a documentation, that I was able to find, was in the source: https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListViewDataSource.js
another source that helped was: http://www.reactnative.com/react-native-tutorial-for-creating-listview-with-section-headers/
but again, it was fairly limited.
so, I would like to suggest that ListView.DataSource
be added to the docs (as a page of it’s own)
and include a few examples.
also, I think this a very common use case and should probably be included in the docs.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
These examples should help anybody having trouble understanding how to deal ListView’s dataSource.
Rows: https://rnplay.org/apps/d3DM6A Rows with Sections: https://rnplay.org/apps/xnyaYw
@brentvatne You can maybe take a look at these examples. If they are good enough you can maybe fork them over to the account for the examples and link them inside the docs.
@christopherdro It’s alright. I got the idea, that’s the point 😃
Thanks a lot. You have been really helpful.