indexdbに名前と給与の2つのカラムがあり、両方にインデックスがあるとします。IndexDbの1つのカーソルから得られた結果をソートする方法
今私はこのようなインデックス名の上にカーソルと範囲を使用して結果を取得している -
var value ="ujjwal";
var trans = db.transaction(['employee'], "readonly");
var store = trans.objectStore('employee');
var index = store.index('name');
var cursorRequest = index.openCursor(IDBKeyRange.only(value)),
res = new Array();
cursorRequest.onsuccess = function(e) {
var cursor = e.target.result;
if (cursor) {
res.push(cursor.value);
cursor.continue();
}
};
ので、今、私は複数の結果を得ました。どのように私は給料でそれらを並べ替えることができます。
私はIndexedDを使用してこれを行いたいです。私は既に給与計算列にインデックスを持っています。
をhttps://stackoverflow.com/questions/12084177/in- indexeddb-there-a-way-to-make-a-sorted-compound-query –