Problem with Search then click-zoom-into

Discussion created by dexconor on Jun 13, 2013
Latest reply on Jun 14, 2013 by dexconor
Hello everyone,

I slightly change code from
but I can't get it to work.

So far, the results highlighted on the map but no list return (dojo grid).

I'm not sure that where should I fix or change
searching 4 layers but they are having different column name but would it be a problem? if so should I make all the layers have same column name for all layers?

Please help me to get it work.

function init()
        findTask = new esri.tasks.FindTask("http://localhost:6080/arcgis/rest/services/FC/MapInfo/MapServer");

        dojo.connect(map, "onLoad", function() {
          //Create the find parameters
          findParams = new esri.tasks.FindParameters();
          findParams.returnGeometry = true;
          findParams.layerIds = [0,1,2,3];
          findParams.searchFields = ["Number","Name","Abbrev"];
          findParams.outSpatialReference = map.spatialReference;
          console.log("find sr: ", findParams.outSpatialReference);

function doFind() {
        //Set the search text to the value in the box
        findParams.searchText = dojo.byId("searchField").value;

      function showResults(results) {
  // alert(results);
        //This function works with an array of FindResult that the task returns;
        var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5]));

        //create array of attributes
        var items =,function(result){
          var graphic = result.feature;
          return result.feature.attributes;

        //Create data object to be used in store
        var data = {
          identifier: "OBJECTID",  //This field needs to have unique values
          label: "PARCELID", //Name field for display. Not pertinent to a grid but may be used elsewhere.
          items: items

         //Create data store and bind to grid.
        store = new{ data:data });
        var grid = dijit.byId('grid');

        //Zoom back to the initial map extent
        map.centerAndZoom(center, zoom);

      //Zoom to the parcel when the user clicks a row
      function onRowClickHandler(evt){
        var clickedTaxLotId = grid.getItem(evt.rowIndex).PARCELID;
        var selectedTaxLot;

          if((graphic.attributes) && graphic.attributes.PARCELID === clickedTaxLotId){
            selectedTaxLot = graphic;
        var taxLotExtent = selectedTaxLot.geometry.getExtent();

<input type="text" id="searchField" size="30" value="" /><button data-dojo-type="dijit.form.Button"  onClick="doFind();" value="Search">
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid"  id="grid" data-dojo-props="rowsPerPage:'10', rowSelector:'20px'">
          <th field="PARCELID">Parcel ID</th>
          <th field="Number" >Owner 1</th>
          <th field="Abbrev">Owner 2</th>
          <th field="CampusCode">Year Built</th>