Select to view content in your preferred language

How to zoom to & highlight on specific polygon on results listitem for mobile

1922
4
Jump to solution
12-15-2014 07:33 AM
MayJeff
Deactivated User

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:

Edit fiddle - JSFiddle

Thank you.

0 Kudos
1 Solution

Accepted Solutions
MarkMallany
Deactivated User

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?

Edit fiddle - JSFiddle

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);

}

View solution in original post

0 Kudos
4 Replies
MarkMallany
Deactivated User

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!

Edit fiddle - JSFiddle

0 Kudos
MayJeff
Deactivated User

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.

0 Kudos
MarkMallany
Deactivated User

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?

Edit fiddle - JSFiddle

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);

}

0 Kudos
MayJeff
Deactivated User

Thank you so much for your help.

0 Kudos