Hello, I am using WAB 2.2 Jewelry box theme. I have features selected and would now like to zoom to those selected features. How do I zoom to selected features on the map?
Thank You,
Greg
Solved! Go to Solution.
Robert,
You are correct, the array has a zero length. So how do I get this to work? How do I make it "wait" for the selection to complete to activate the zoom to portion of the code?
Greg
Greg,
The selectFeatures is a deferred returning method so you just need to use a callback function like you do for any deferred.
cableLayer.selectFeatures(cableSelectQuery, cableLayer.SELECTION_NEW, lang.hitch(this, function(results){
var selMgr = SelectionMgr.getInstance();
var geom = selMgr.getUnionGeometryBySelectedFeatures(cableLayer);
this.map.setExtent(geom.getExtent().expand(1.2), true);
}));
Robert,
Thank you for the efforts that got it.
Greg