Hi all,
I am trying to add a feature layer (with a definiton expression to display a user-selected geography) with an onclick event showing the infoWindow. This function works well the first time I add the feature layer for the selected state. When the user selects another state, the display works fine (removes previous selection and shows features for the new selected state), but infoWindow function does not work at all. The click event does not bring up the infoWindow. JavaScript console shows the error as 'Type error' and 'dojo.Deferred.reject.errback'. Any help will be appreciated. I can attach the full code if needed. Here is relevant part of the code:

function viewIndicator(State){
...
else if (unitDistActiveM==true){
if (State!="All India"){
distFeatureLayer.setDefinitionExpression("s_name_11='"+State+"'");
}
distFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
mapM.removeLayer(stateFeatureLayer);
dojo.connect(distFeatureLayer, "onSelectionComplete", mapM.addLayers(distFeatureLayer));
showLegend();
mapM.addLayers([distFeatureLayer]);
dojo.connect(distFeatureLayer, "onClick", showHighlight);
}
...
}

function showHighlight(evt) {
mapM.graphics.clear();
var content = evt.graphic.getContent();
mapM.infoWindow.setContent(content);
var title = evt.graphic.getTitle();
mapM.infoWindow.setTitle(title);
var highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSymbol);
mapM.graphics.add(highlightGraphic);
mapM.infoWindow.show(evt.screenPoint,mapM.getInfoWindowAnchor(evt.screenPoint));
dojo.connect(mapM.infoWindow, "onHide", clearGraphics);
}
...

Thanks
Samir