Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

has anyone ever put the results of a RelationshipQuery() into a map.infoWindow that's been replaced with a dijit.popup?

here's the workflow: user clicks a point, all identify results are put into popup. <--this part is fine

I'm struggling with calling a relationshipquery then putting the results into the infoTemplate.

findRelatedRecords performs 3 relationship queries and assembles an array of objects that are related to the single point. I cannot get this data back into the executeIdentifyTask function.

getWindowContent takes the relationshipquery array and converts it to html and constructs a dijit.tabcontainer & 2 contentpanes (tabs). I return the tabcontainer.domNode.

Any help? I'm really struggling!!

function executeIdentifyTask(evt) {
    facSel.clearSelection();
    identifyParams.geometry = evt.mapPoint;
    identifyParams.mapExtent = map.extent;

    var deferred = identifyTask.execute(identifyParams);

    deferred.addCallback(function(response) {

      // response is an array of identify result objects    
      // Let's return an array of features.
      return dojo.map(response, function(result) {
        var feature = result.feature;
        console.log(result);
        //feature.attributes.layerName = result.layerName;
        if(result.layerName === 'parcel_area2'){
          //console.log(feature.attributes.site_code);
          var template = new esri.InfoTemplate("", "${site_code} <br/> Owner of record: ${facil_loca}");
          feature.setInfoTemplate(template);
        }
        else if (result.layerName === 'logistics2'){
          var template = new esri.InfoTemplate("", "Parcel ID: ${Type}");
          feature.setInfoTemplate(template);
        }
        else if (result.layerName === 'query2'){
            findRelatedRecords(feature,evt) //<--get relationship query results here    
            var template = new esri.InfoTemplate("", getWindowContent(data,evt.graphic));
            feature.setInfoTemplate(template);          

        }
        return feature;
      });
    });
    // InfoWindow expects an array of features from each deferred
    // object that you pass. If the response from the task execution
    // above is not an array of features, then you need to add a callback
    // like the one above to post-process the response and return an
    // array of features.
    map.infoWindow.setFeatures([ deferred ]);
    map.infoWindow.show(evt.mapPoint);

  } 
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.