AnsweredAssumed Answered

QueryTask: graphics not being drawn?

Question asked by rmartin4 on Aug 9, 2013
Latest reply on Aug 10, 2013 by rmartin4
Hi all,

I am trying to implement a query task in my JS app per this tutorial:

After a little finagling everything seems to be working fine -- the query returns the expected feature and the callback gets called. But nothing is showing up on the map. Are there any caveats I should know about? This is how I initialize the query, etc.:

// Initialize query task queryTask = new QueryTask('http://myurl');  // Initialize query query = new Query(); query.returnGeometry = true; query.outFields = ['PIND'];  // Initialize info template infoTemplate = new InfoTemplate('${PIND}', 'PIND: ${PIND}');  // Initialize symbol symbol = new SimpleFillSymbol(  SimpleFillSymbol.STYLE_SOLID,  new SimpleLineSymbol(   SimpleLineSymbol.STYLE_SOLID,   new Color([255.0, 0.0, 0.0])  ),  new Color([255.0, 0.0, 0.0, 0.25]) );

And this is my drawing function:

function drawFeatureSet(featureSet) {  try {   // Clear graphics;    // Loop through features   for (feature in featureSet.features) {    feature.symbol = symbol;    feature.infoTemplate = infoTemplate;;   }  }  catch(e) {   console.log(e.message);  } }

If I try logging the contents of the graphics layer after adding all I see is ["0"]. Strange...

Thanks for your help!