Untested, but possible concept:
define(['dojo/on', 'dojo/_base/lang', 'esri/tasks/query'], function (on, lang, Query) {
/**
* @param {esri.Map} map
* @param {esri.layers.FeatureLayer} pointLayer
* @param {esri.layers.FeatureLayer} polyLayer
* @return removable handle
*/
function tiePointLayerToPolygons(map, pointLayer, polyLayer) {
/**
* Callback for clicks on point layer.
* @param {MouseEvent} evt
* @param {esri.Graphic} evt.graphic - the graphic which was clicked.
*/
var query = function (evt) {
var iw = map.infoWindow,
pt = evt.graphic.geometry;
// return if no window
if (!iw) {
return;
}
polyLayer.queryFeatures(lang.mixin(new Query(), {
geometry: pt,
spatialRelationship: Query.SPATIAL_REL_CONTAINS
})).then(function (featureSet) {
// assuming info window is popup...if not this will need tweaking
iw.setFeatures(featureSet.features);
// show infow window at the clicked point
iw.show(pt);
});
};
// listen to clicks on point layer.
return on(pointLayer, 'click', query);
}
return tiePointLayerToPolygons;
});