AnsweredAssumed Answered

Open Info Window on grid RowClick

Question asked by rhyck.m on Sep 25, 2014
Latest reply on Oct 2, 2014 by schlot

I have the code below that shows the info window on map click. I would like to call the same function in the gridRowClick event.

 

function identifyPOI(evt) {


    var measureMode = dojo.query(".esriButton .dijitButtonNode").some(function (node, index, arr) {
        if (node.childNodes[0].checked) {
            //at least one of the measure tools is active so disable identify  
            return true;


        }
    });


    if (!measureMode) {


        var identify = new esri.tasks.IdentifyTask(".../MapServer");
        var identifyParams = new esri.tasks.IdentifyParameters();
        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;
        identifyParams.returnGeometry = true;
        identifyParams.tolerance = 3;


        map.infoWindow.clearFeatures();
        
        //Define a good infoTemplate
        var infoTemplateUtilities = new esri.InfoTemplate();
        
        infoTemplateUtilities.setTitle("FacilityID: <br/> <b>${Facility Identifier}</b>");
        infoTemplateUtilities.setContent("Open file:  <b> <a href='Documentation/${MAPREF}.pdf' target='_blank'> ${MAPREF} </a>  </b><br/>" +
                                  "Install Date: <b>${Install Date} </b><br/>" +
                                  "Material: <b>${Material}</b><br/>" +
                                  "Diameter: <b>${Diameter}</b> <br/>" +
                                  "Status: <b>${Status}</b> <br/>" +
                                  "Last Update Date: <b>${Last Update Date}</b> <br/>" +
                                  "Water Type: <b>${Water Type}</b> <br/>" +
                                  "Lenght(ft): <b>${SHAPE_Length}</b> <br/>");


        try {
            identify.execute(identifyParams, function (results) {


                map.infoWindow.setFeatures(dojo.map(results, function (result) {
                    var feature = result.feature;
                    feature.setInfoTemplate(infoTemplateUtilities);
                    return feature;
                }));
                map.infoWindow.show(evt.mapPoint);
            });


        }
        catch (ex) {
            alert(ex.toString());
        }
      
    }

};




function onRowClickHandler(evt) {
    var clickedUtilityId = grid.getItem(evt.rowIndex).OBJECTID;


    var selectedUtility;
    
    dojo.forEach(map.graphics.graphics, function (graphic) {
        if ((graphic.attributes) && graphic.attributes.OBJECTID === clickedUtilityId) {
            selectedUtility = graphic.geometry;
            return;
        }
    });
    


    var thePoly = selectedUtility;
    var theExtent = thePoly.getExtent();
    map.setExtent(theExtent, true);


    //and display the infoWindow
    var utilityLenght = thePoly.paths[0].length;
    if(utilityLenght % 2 !=0){
       utilityLenght = utilityLenght - 1;


       var pointXY = thePoly.paths[0][(utilityLenght / 2)];


       var infoPoint = new esri.geometry.Point(pointXY[0], pointXY[1], new esri.spatialReference({ wkid: 102723 }));


       try{
        
           identifyPOI(evt.infoPoint); //<====  here is where I am not sure... 
        }
       catch (ex) {
           alert(ex.toString());
       }
      
        
    }
    
};

 

 

the image below is the final result I am trying to achieve.

 

RowClick_Info_Window.PNG

Outcomes