我如何到达表头=“1”

时间:2012-12-06 10:31:36

标签: javascript select datagrid dojo arcgis

在这个例子中:

function onRowClickHandler(evt){
    var clickedTaxLotId = grid.getItem(evt.rowIndex).PARCELID;
    var selectedTaxLot;

    dojo.forEach(map.graphics.graphics,function(graphic){
      if((graphic.attributes) && graphic.attributes.PARCELID === clickedTaxLotId){
        selectedTaxLot = graphic;
        return;
      }
    });
    var taxLotExtent = selectedTaxLot.geometry.getExtent();
    map.setExtent(taxLotExtent);
  }

他们从这里选择PARCELID:

      <th field="PARCELID">Parcel ID</th>
      <th field="OWNERNME1" >Owner 1</th>
      <th field="OWNERNME2">Owner 2</th>
      <th field="RESYRBLT ">Year Built</th>
      <th field="SITEADDRESS" width="100%">Address</th>

但现在我的问题是我有<th field="1">不可更改。但我需要得到像var clickedTaxLotId = grid.getItem(evt.rowIndex).2;这样的值,但在javascript中是不可能的。

表标题如下所示:

 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'" style="height:350px;" >
<table data-dojo-type="dojox.grid.DataGrid" jsid="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
  <thead>
    <tr>

      <th field="0" width="auto" >
        Gezocht op
      </th>
      <th field="1" width="auto" >
        Gevonden
      </th>

    </tr>
  </thead>
</table>

修改

这里我设置了th字段的值。这由dataForGrid完成。第一个字段为“0”并填充result.foundFieldName,“1”with result.value

 map.graphics.clear();
    var dataForGrid = [];
    //Build an array of attribute information and add each found graphic to the map
    dojo.forEach(results, function(result) {
      var graphic = result.feature;
      dataForGrid.push([result.foundFieldName, result.value]);
      var userlabel = result.value;
      switch (graphic.geometry.type) {
      case "point":
        graphic.setSymbol(markerSymbol);
        break;
      case "polyline":
        graphic.setSymbol(lineSymbol);
        break;
      case "polygon":
        graphic.setSymbol(polygonSymbol);
        break;
      }
      map.graphics.add(graphic);
    });
    var data = {

      items: dataForGrid
    };
    var store = new dojo.data.ItemFileReadStore({
      data: data
    });
    grid.setStore(store);
  }

0 个答案:

没有答案