[英]Javascript - Retrieve Data from the DOM
我正在嘗試使用Javascript從DOM中獲取數據。
我的樹是: this.caseCodingList.grid.store.__proto__.index
我需要從索引中檢索ID之一。 沒關系。 這是我嘗試過的各種嘗試,但失敗了。
嘗試一:
var grid = this.caseCodingList.grid;
var row = grid.store.getPrototypeOf(data).get(0);
嘗試二:
var row = grid.store.getData();
嘗試三:
var index = grid.store.__proto__.index
這個確實返回了一些東西,但是我無法提取我想要的東西。 我也不知道它是否將與跨瀏覽器兼容。 我主要使用Chrome進行開發。 結果:
{871: 3, {A9A1B512-8E93-4131-B9CD-85C1AEF04722}: 0, {C249D8F2-4561-4657-A6CF-039C0DC89898}: 1, {82FDAFEA-6DCC-483C-BEB7-DDF37818A4C5}: 2}
有什么建議么? 謝謝!
const index = grid.store.index;
const idOfObjectWithZeroEntries = Object
.keys(index)
.find(x => index[x] === 0);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.