Select to view content in your preferred language

Display map graphic in new window using getDojoShape

952
1
07-08-2013 09:50 AM
TyroneLigon
Deactivated User
I have an HTML page function receiving a graphic in JSON format. The page has a div to hold the graphic's shape, and another div to hold the graphic's infoTemplate content. Here's the code snippet:

function displayAttributeInfo(graphicJson){
  var theGraphic = new esri.Graphic(graphicJson);
  var theSurface = new dojox.gfx.createSurface("graphicSurface", 20, 20);
  var theShape = theGraphic.getDojoShape();
  theSurface.add(theShape);
  $("#attributeContent").html(theGraphic.getContent());
}


In Firebug I see the creation of the surface, but "getDojoShape" is causing an error in the "init.js" script: "TypeError: _a7 is null". I also see that when the graphic is created, its graphics layer and shape are null. Does the graphic need to be added to a graphics layer before the shape becomes valid? Or am I going about this the wrong way?
1 Reply
TyroneLigon
Deactivated User
Resolved this by using the dojox.gfx library and creating shapes on the fly, using the parameters (color, size, outline, image URL, etc.) from the incoming graphic's symbol.
0 Kudos