Greetings to all,
Greetings, I am a populating a listview with documents from couchdb in a descending order, but whenever a document is updated it immediately moves to the top of the listview and when a new document is included it is added below the old document instead of on top of it. I understand that whenever changeEven is fired, code re-creates the data in Adapter and it re-populates the list view…How can I work around this? Such that when a new doc is added it goes to the top, and when a doc is changed it remains in the same position. Here is a code snippet of querying the view:
The list view is using the sort order defined by the keys in the CBL view being queried. If you want a different sort order, you’ll need to change the view and/or the document schema to emit the right keys.
In your case it sounds like you should store the document’s creation date (which would not be changed when you update the doc) and use that as the key. Then docs will be listed in order created. Of course you’ll want to reverse the order in the query.
hey @jens and @sweetiewill thanks for the reply. I have tried to emit the doc. based on the creationdate, but now it doesnt descend at all. Basically am trying to populate the listview if someones phone no. belongs to the field “p1phone” or “p2phone”. Here is the view: