InfoWindow not being populated but just in IE!!!

735
4
05-13-2012 05:39 AM
JayGregory
New Contributor III
Hi - I have a fairly simple function that uses the attributeInspector to populate and infoWindow.  It works GREAT in Mozilla and Chome.  But nothing in IE.  The infoWindow is just empty - there is nothing there except the infoWindow's title.  Any suggestions?
function roadObstructionsPopup(evt) {
 var graphic = evt.graphic;
 var geom = graphic.geometry;
 hideAll();
 var lyInfos = [{
   'featureLayer' : roadObstructionsLayer,
   'showAttachments' : true,
   'isEditable' : true,
   'fieldInfos' : [{
     'fieldName' : 'DESCRIPTION',
     'isEditable' : true,
     'tooltip' : 'Short Description',
     'label' : 'Description:'
    }, {
     'fieldName' : 'DATE_REPORTED',
     'isEditable' : true,
     'tooltip' : 'Report Date',
     'label' : 'Date'
    }, {
     'fieldName' : 'STATUS',
     'isEditable' : true,
     'label' : 'Status:'
    }
   ]
  }
 ];
 try {
  attInspector = new esri.dijit.AttributeInspector({
    layerInfos : lyInfos
   }, "infoWindowContents");
  var saveButton = new dijit.form.Button({
    label : "Save",
    "class" : "saveButton"
   });
  dojo.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");
  dojo.connect(saveButton, "onClick", function () {
   updateFeature.getLayer().applyEdits(null, [updateFeature], null, function(results){$('#alert').jGrowl("Road obstruction saved");
   map.infoWindow.hide();}, function (error) {
    $('#alert').jGrowl("Could not save obstruction due to " + error.message, {
     header : 'Error'
    });
   });
  map.infoWindow.hide();
  });
  
  dojo.connect(attInspector, "onAttributeChange", function (feature, fieldName, newFieldValue) {
   //store the updates to apply when the save button is clicked
   updateFeature.attributes[fieldName] = newFieldValue;
  });
  dojo.connect(attInspector, "onNext", function (feature) {
   updateFeature = feature;
  });
  dojo.connect(attInspector, "onDelete", function (feature) {
   feature.getLayer().applyEdits(null, null, [feature], function(results){
  roadObstructionsLayer.refresh();
  $('#alert').jGrowl("Sucessfully deleted road obstruction");
  }, function (error) {
    $('#alert').jGrowl("Could not delete road obstructions due to " + error.message, {
     header : 'Error'
    });
   });
     map.infoWindow.hide();
  });
  var tolerance = 5;
  var pxWidth = map.extent.getWidth() / map.width;
  var padding = tolerance * pxWidth + 60;
  var selectQuerygeometry = new esri.geometry.Extent({
    'xmin' : geom.x - padding,
    'ymin' : geom.y - padding,
    'xmax' : geom.x + padding,
    'ymax' : geom.y + padding,
    'spatialReference' : map.spatialReference
   });
  selectQuery.geometry = selectQuerygeometry;
  roadObstructionsLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
   if (features.length > 0) {
    console.log(attInspector.domNode);
    updateFeature = features[0];
    map.infoWindow.setTitle("Edit Window");
    map.infoWindow.setContent(attInspector.domNode);
    //dojo.byId('infoWindowContents').innerHTML = attInspector.domNode;
    map.infoWindow.resize(300, 400);
    console.log(features[0]);
    esri.show(dojo.byId("infoWindowContents"));
    //var screenPoint = geom.screenPoint;
    map.infoWindow.show(evt.graphic.geometry);
   } else {
    map.infoWindow.hide();
   }
  });
 } catch (error) {
  dijit.byId("infoWindowContents").destroy();
  roadObstructionsPopup(evt);
 }
}
0 Kudos
4 Replies
JeffPace
MVP Alum
 
  dojo.connect(saveButton, "onClick", function () {
   updateFeature.getLayer().applyEdits(null, [updateFeature], null, function(results){$('#alert').jGrowl("Road obstruction saved");
   map.infoWindow.hide();
   }, function (error) {
    $('#alert').jGrowl("Could not save obstruction due to " + error.message, {
     header : 'Error'
    });
   });
  map.infoWindow.hide();
  });
  


I think you have a syntax error in here that IE cares about but mozilla can get past.
0 Kudos
JayGregory
New Contributor III
Thanks - I'm not sure that is the issue, because that bracket is in my original code - I just formatted the entire thing poorly so it's difficult to see.

dojo.connect(saveButton, "onClick", function () {
   updateFeature.getLayer().applyEdits(null, [updateFeature], null, function(results){$('#alert').jGrowl("Road obstruction saved");
   map.infoWindow.hide();}, function (error) {
    $('#alert').jGrowl("Could not save obstruction due to " + error.message, {
     header : 'Error'
    });
   });
  map.infoWindow.hide();
  });
0 Kudos
JeffPace
MVP Alum
right, i think its an error in the original code.

That bracket seems to close the function, which means the comma after it doesnt make sense.

Just saying IE has a huge issue with commas where they dont belong.  It will shatter JSON, in IE for example, but chrome and mozilla will be fine.
0 Kudos
JayGregory
New Contributor III
Ahh - okay - I understand what you're saying.  Maybe my javascript isn't up to par, but I was under the impression you were supposed to close callback functions explicitly:

function (parameter1, parameter 2, successCallback {stuff}, errorCallback{stuff});

Do I have that wrong?
0 Kudos