var txtSing = "SIGNTYPE = "; var grid; function doQuery() { query.where = (txtSing + "\'" + dojo.byId("SignQuery").value + "\'").toString(); //execute query queryTask.execute(query,showFResults); } function showFResults(results) { //remove all graphics on the maps graphics layer map.graphics.clear(); esri.show(dojo.byId("grid")); var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5])); var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 255]), 1), new dojo.Color([0, 255, 0, 0.25])); var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1); var items = []; dojo.forEach(results.features, function (feature) { var graphic = feature; switch (graphic.geometry.type) { case "point": graphic.setSymbol(markerSymbol); break; case "polyline": graphic.setSymbol(lineSymbol); break; case "polygon": graphic.setSymbol(polygonSymbol); break; } // //Set the infoTemplate. graphic.setInfoTemplate(SignInfoTemplate); //Add graphic to map map.graphics.add(graphic); // return feature.feature.attributes; items.push(feature.attributes); }); //Create data object to be used in store var data = { identifier: "OBJECTID", //This field needs to have unique values label: "OBJECTID", //Name field for display. Not pertinent to a grid but may be used elsewhere. items: items }; //Create data store and bind to grid. store = new dojo.data.ItemFileReadStore({ data:data }); grid = dijit.byId('grid'); grid.setStore(store); // Show Grid // esri.show(dojo.byId("grid")); //Zoom back to extent of graphics selected var graphicExtent = esri.graphicsExtent(map.graphics.graphics); map.setExtent(graphicExtent); }
Solved! Go to Solution.
var items = []; dojo.forEach(results.features, function (feature) { var graphic = feature; switch (graphic.geometry.type) { case "point": graphic.setSymbol(markerSymbol); break; case "polyline": graphic.setSymbol(lineSymbol); break; case "polygon": graphic.setSymbol(polygonSymbol); break; } // //Set the infoTemplate. graphic.setInfoTemplate(SignInfoTemplate); //Add graphic to map map.graphics.add(graphic); //return feature.attributes; items.push(feature.attributes); var Istring = items.toString(); alert(Istring); });
var items = []; for (var i=0, il=results.features.length; i<il; i++) { items.push(results.features.attributes); } var Istring = items.toString(); //send to string alert(Istring); //show string -- where I see [object, Object]