Pagination Using StartAt() When Ordering By Child
I am trying to just retrieve a list of records, sorted by one of the fields in each record, and I would like to be able to retrieve the data in pages. According to the Firebase doc
Solution 1:
You're almost there!
The problem is in how you call startAt
for the second page:
.startAt(null, '-KlstB51ap1L2tcK8cL6')
To get the correct results you need to pass in both the price and the key of the so-called anchor item:
.startAt(99, '-KlstB51ap1L2tcK8cL6')
With that Firebase will find all items with price
99
and then return items starting at key '-KlstB51ap1L2tcK8cL6'
.
Post a Comment for "Pagination Using StartAt() When Ordering By Child"