0

I am trying to get data from the DOM using Javascript.

My tree is: this.caseCodingList.grid.store.__proto__.index

I need to retrieve one of the IDs from the index. It doesn't matter which. Here are various things I have tried, but failed on.

Attempt One:

var grid = this.caseCodingList.grid;
var row = grid.store.getPrototypeOf(data).get(0);

Attempt Two:

var row = grid.store.getData();

Attempe Three:

var index = grid.store.__proto__.index

This one does return something, but I am not able to extract what I want. I also don't know if it will be cross browser compatible. I am developing mainly with Chrome. Results:

{871: 3, {A9A1B512-8E93-4131-B9CD-85C1AEF04722}: 0, {C249D8F2-4561-4657-A6CF-039C0DC89898}: 1, {82FDAFEA-6DCC-483C-BEB7-DDF37818A4C5}: 2}

Any suggestions? Thanks!

enter image description here

staples
  • 424
  • 2
  • 8
  • 24

1 Answers1

1
const index = grid.store.index;
const idOfObjectWithZeroEntries = Object
    .keys(index)
    .find(x => index[x] === 0);
vzwick
  • 11,008
  • 5
  • 43
  • 63
  • Thank you for your time in understanding my issue! I had to change `const` to `var` to get it to work, but not a big deal. Again, thanks! – staples Oct 30 '18 at 15:12