2014-10-31 31 views
1

我遇到的問題是IE11的代碼在Google Chrome中可用。複合索引的IE11 IDBIndex.openCursor()不會返回結果

考慮在與具有兩個字段的化合物鍵typekey對象存儲以下查詢:類型,docID的

store.createIndex("typekey", [ "type", "docID" ], { unique: false }); 

...

idb.transaction("inbox") 
    .objectStore("inbox") 
    .index("typekey") 
    .openCursor() 
    .onsuccess = function(e) { 
     debugger; 
     // e.target.result is null, even though there are records in the objectStore 
    }; 

使用考慮在同一個表的查詢主鍵。

idb.transaction("inbox") 
    .objectStore("inbox") 
    .openCursor() 
    .onsuccess = function(e) { 
     debugger; 
     // e.target.result is an IDBCursorWithValue as expected 
    }; 

爲什麼Internet Explorer在第一個實例中不返回任何結果?

回答

0

「多入索引和複合索引是不一樣的事情。然而,IE不支持任一功能。」 - dumbmatter 11月1日在3:29

(從下面的註釋)

1

根據createIndex的參考頁,IE不支持多條目索引。

在Windows開發者論壇上有一個related thread,它討論了可能的解決方法。

希望這有助於...

- 蘭斯

+1

多項索引和複合索引不是同一回事。但是,IE不支持這兩種功能。 – dumbmatter 2014-11-01 03:29:22

+0

我不使用multiEntry,也指定一個數組(字符串序列)和multiEntry:根據規範,true是非法的。 「如果keyPath是一個序列,並且optionalParameters中的multiEntry屬性爲true,那麼實現必須拋出一個類型爲InvalidAccessError的DOMException。」 – 2014-11-03 12:36:36

+0

dumbmatter如果您將您的評論添加爲答案,我可以將此問題標記爲已回答 – 2014-11-07 14:28:55