Hi Heming
Thanks a lot for your help with this, figured out that I need to use the geometry property just as I posted my last reply.
Thanks again! 🙂
PS - How can I give you credit for this? I cannot find a "this post answered my question" option anywhere?
Hi Heming
Sorry but I have stumbled upon another problem so if you fancy figuring the following out I would appreciate it! 🙂
All of my candidate addresses are coming up in the data grid and I can successfully zoom to each one which is great, but I am trying to limit the number of results that are outputted to the grid using an if statement which is used in the ESRI locator sample (the code snippet below is what I have tried to use).
I run it when the array 'items' is built to try and only select those that have a candidate score of 80 or above - my graphics layer is successfully drawing only those candidates that have a score of +80 but the data grid has an error, when using firebug it mentions that it "cannot set property '_RI' of undefined".
Digging a bit deeper this variable seems to be set in the dojo.data.ItemFileReadStore:-
this._rootItemPropName = "_RI"; // Default Item Id for isItem to attach to every item.
This might be something more dojo related but I don't suppose you have any other possible ways of limiting the candidates down by scores or indeed if the above error might be solvable?
I appreciate all the help you have given me so far! 🙂
//CODE
//create array of attributes
var items = dojo.map(candidates,function(candidate){
if (candidate.score > 80){
geom = new esri.geometry.Point(candidate.location.x, candidate.location.y);
var attributes = candidate.attributes;
var scoreCandidate = candidate.score;
var graphic = new esri.Graphic(geom, symbol, attributes);
//add a graphic to the map at the geocoded location
map.graphics.add(graphic);
return candidate.attributes;//break out of loop after one candidate with score greater than 80 is found.
}
});
//CODE
What would the datagrid headings look like? I get an error when trying to bind the datastore to the following datagrid:
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="AddressGrid" id="AddressGrid"
data-dojo-props="rowSelector:''" style="width: 325px; height: 350px;
margin: 0; overflow: scroll">
<thead>
<tr>
<th field="Match_addr">
Match_addr
</th>
<th field="Score">
Score
</th>
<th field="Ref_ID">
Ref_ID
</th>
</tr>
</thead>
</table>
... var layout = { cells: [ { field: "Match_addr", name: "Match Address", width: 'auto' }, { field: "Score", name: "Scores", width: '125px' }, { field: "Ref_ID", name: "Reference ID", width: '125px' } ] }; var grid = dijit.byId("AddressGriD"); grid.attr("structure", layout); ...
Thanks for the quick response. I was originally using a composite locator and could not bind it and assumed my data grid was structured wrong. However, once I used a single locator, I could bind. I guess the composite returns a different array structure.
Thanks again.