I want to sort the results obtained from indexedDB.
Each entry has the structure {id, text, date}, where 'id' is keyPath.
I want to sort the results by date.
My current code is as follows:
var trans = db.transaction(['msgs'], IDBTransaction.READ); var store = trans.objectStore('msgs'); // Get everything in the store; var keyRange = IDBKeyRange.lowerBound(""); var cursorRequest = store.openCursor(keyRange); cursorRequest.onsuccess = function(e) { var result = e.target.result; if(!!result == false){ return; } console.log(result.value); result.continue(); };
source share