So I'm a step further along in my geocode query project - and again I am spinning my wheels.
I've successfully
geocoded an address > queried zipcode layer to ascertain population density > create buffers dependant on density > queried Sales reps within those buffers
so I've got the reps queried, and have them in a feature set. If I send
I get all the sales rep info im looking for in the console.
I'm trying to build this attribute data into a clickable table, but I'm getting nowhere.
Help?!
At this point in the code, the buffers have been created already, and the reps have been queried. The following gets fired upon completion of the sales rep query:
Then populateTable(repResultFeatures[i]); launches, but I get nothing in my data grid:
Thanks.
I've successfully
geocoded an address > queried zipcode layer to ascertain population density > create buffers dependant on density > queried Sales reps within those buffers
so I've got the reps queried, and have them in a feature set. If I send
console.log(repFet)
I get all the sales rep info im looking for in the console.
I'm trying to build this attribute data into a clickable table, but I'm getting nowhere.
Help?!
At this point in the code, the buffers have been created already, and the reps have been queried. The following gets fired upon completion of the sales rep query:
function doRepManager(fset){ //draws the rep points, fires populateTable var symbol = new esri.symbol.SimpleMarkerSymbol(); symbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE; symbol.setSize(6); symbol.setColor(new dojo.Color([219, 112, 147, 1])); var repResultFeatures = fset.features; for (var i = 0, il = repResultFeatures.length; i < il; i++) { var repGraphic = repResultFeatures[i]; repGraphic.setSymbol(symbol); map.graphics.add(repGraphic); populateTable(repResultFeatures[i]); }; };
Then populateTable(repResultFeatures[i]); launches, but I get nothing in my data grid:
function populateTable(repFet){ //creates and populates the dojo datagrid console.log(repFet); var items = dojo.map(repFet,function(result){ return repFet.features.attributes; }); //Create data object to be used in store var data = { identifier: "rep_no", //This field needs to have unique values items: items }; //Create data store and bind to grid. store = new dojo.data.ItemFileReadStore({ data:data }); var grid = dijit.byId('grid'); grid.setStore(store); };
Thanks.
The following code ties the grid with the query results interactively. All you need to do is define a dojo datagrid in you markup.
Once you did that, run the codes similiar to the following to tie the grid data store to featureSet. features.
Let me know if you have any questions.