I run a query search for ownership then return a total list of the results. How do you perform a click on each items on the list that able to highlight and zoom to polygon?
Here is my jsfiddle:
Thank you.
Solved! Go to Solution.
I dont think you need that loop. The map extent is getting set for each feature, with the last ( or second to last) feature getting zoomed to just because its called last. How about this? i just called your setExtent logic on the result passed into the function?
var locationDetails = function(result) {
mapResults(result);
var widget = registry.byId('resultsContainer1');
widget.performTransition('mapView', 1, "slide");
map.setExtent(result.geometry.getExtent(), true);
var result = result;
result.setSymbol(sfs);
}
Not sure if this answers your question, Are you trying to remove your "View Map" button and just have the users click on the ListItem instead?
If so, you can just make your ListItems "clickable" and register a onClick method just like you were doing on the button. Hope this helps!
Actually I need each results able to zoom to specific polygon when you click on the "View Map" button or click on the ListItems. But so far only zoom to the same polygon. Not sure what to add on the function.
// problem here-----------------
dojo.forEach(results.features, function(feature, index) {
if (index === 0 || index === results.features.length - 1) {//first and list entries don't use a click event
map.setExtent(results.features[index].geometry.getExtent(), true);
var graphic = result;
graphic.setSymbol(sfs);
}
});
// -------------------
Hope can help me to take a look. Thank you.
I dont think you need that loop. The map extent is getting set for each feature, with the last ( or second to last) feature getting zoomed to just because its called last. How about this? i just called your setExtent logic on the result passed into the function?
var locationDetails = function(result) {
mapResults(result);
var widget = registry.byId('resultsContainer1');
widget.performTransition('mapView', 1, "slide");
map.setExtent(result.geometry.getExtent(), true);
var result = result;
result.setSymbol(sfs);
}
Thank you so much for your help.