AnsweredAssumed Answered

Dgrid to display Query Results.

Question asked by HuyQuoc on Mar 2, 2016
Latest reply on Apr 3, 2016 by HuyQuoc

Hi, I'm using Dgrid to display Query Results. I want to dynamic add feature data to store. Here is two code paragraphs:

First Code:

var typesData = [];
  for (var i = 0; i < 5; i++) {
  var j ={
  objectid: results.features[i].attributes.objectid,
  madvhc: results.features[i].attributes.madvhc,
  ten: results.features[i].attributes.ten,
  tinh: results.features[i].attributes.tinh,
  diachi: results.features[i].attributes.diachi,
  macosoyte: results.features[i].attributes.macosoyte,
  macsyt1: results.features[i].attributes.macsyt1,
  loaihinhcsyt: results.features[i].attributes.loaihinhcsyt,
  huyen: results.features[i].attributes.huyen,
  matinh: results.features[i].attributes.humatinhyen,
  mahuyen: results.features[i].attributes.mahuyen,
  tuyencsyt: results.features[i].attributes.tuyencsyt,
  kinhdo: results.features[i].attributes.kinhdo,
  vido: results.features[i].attributes.vido,
  xaphuong: results.features[i].attributes.xaphuong,
  filegoc: results.features[i].attributes.filegoc,
  namdieutra: results.features[i].attributes.namdieutra
  };
  typesData.push(j);
  }

 

Second Code:

var typesData = [];
  for (var i = 0; i < 5; i++) {  
       typesData.push(results.features[i].attributes);
  }

 

The first and the second have the same number of fields but the first can display with right row value in grid when selected, the second only get the last row value in grid when selected. I cannot find what is a problem. Please help me.

Outcomes