Select to view content in your preferred language

Need help on how to code  an "Identify listener"

519
3
07-09-2012 03:38 PM
DorotheaKnigge
Deactivated User
Hi,

I have added an Identify function (http://help.arcgis.com/en/webapi/javascript/arcgis/demos/find/find_drilldown.html) to the "Show Find Task results in Datagrid" sample. (http://help.arcgis.com/en/webapi/javascript/arcgis/demos/find/find_map_datagrid.html).

What I would like to do is have the user input an address or parcel number which then adds the search results to the datagrid; the user now clicks on a datagrid record and zooms to the parcel.  Once at the desired location the user clicks on the parcel to find out what the general plan designation is for that parcel.

If the user now wants to click and zoom to another datagrid record the Show Find Task is no longer active. How can I track the function mode so it will work all the time?  Right now the user has to clear the grid and start over with the Find Task.

Thank you,

Dorothea
0 Kudos
3 Replies
StephenLead
Honored Contributor
Hi Dorothea,

If the user now wants to click and zoom to another datagrid record the Show Find Task is no longer active. How can I track the function mode so it will work all the time? Right now the user has to clear the grid and start over with the Find Task.


I'm not sure why the click listener is no longer active at this point. If you put a breakpoint inside the doIdentify function, is it definitely running when you click on the map?

Steve
0 Kudos
DorotheaKnigge
Deactivated User
Hi Stephen, thank you for responding.
I seem to be getting an error at the :
var taxLotExtent=selecedTaxLot.geometry.getExtent();
at which point it informs me that the selected TaxLot is undefined.
I have attached more code if you would like to take a look.  I had to take out some legend items because the .txt file was more than 12.5 kb; I ended up zipping the file anyway.

I appreciate your help,

Dorothea
0 Kudos
StephenLead
Honored Contributor
I seem to be getting an error at the :
var taxLotExtent=selecedTaxLot.geometry.getExtent();
at which point it informs me that the selected TaxLot is undefined.


Hi Dorothea,

Without actually running your code it's hard (for me at least) to say what's wrong. But in this case you're probably seeing an error because there is no value for selectedTaxLot. You could try something like this to debug it.

function onRowClickHandler(evt){
        var clickedTaxLotId = grid.getItem(evt.rowIndex).OBJECTID;
        var selectedTaxLot;
        for (var i=0, il=map.graphics.graphics.length; i<il; i++) {
          var currentGraphic = map.graphics.graphics;
          if ((currentGraphic.attributes) && currentGraphic.attributes.OBJECTID == clickedTaxLotId){
            selectedTaxLot = currentGraphic;
            break;
          }
        }
        if(selectedTaxLot.length > 0) {
            var taxLotExtent = selectedTaxLot.geometry.getExtent();
            map.setExtent(taxLotExtent, true);
       } else {
            alert("can't find a corresponding tax lot to select");
       }
      }


Good luck,
Steve
0 Kudos