setting home widget extent at runtime.

1761
2
Jump to solution
06-29-2016 07:56 AM
NatashaManzuiga
Occasional Contributor

Hi all, I changed my map extent using:

var extent = graphicsUtils.graphicsExtent(featureSet.features).expand(1);

          extent.spatialReference = spatialRef;

          this.map.setExtent(extent, true);

Now I'm trying to set home widget button extent...

Anyone knows how to do it?

Thanks,

Naty

0 Kudos
1 Solution

Accepted Solutions
TaoRuan
New Contributor

Hi Naty,

The extent property of homeButtonWidget can be set, for details: HomeButton | API Reference | ArcGIS API for JavaScript 3.17

In WAB, you could write your code like this:

//get the reference of HomeButtonWidget
var homeButtonWidget = window._widgetManager.getWidgetsByName("HomeButton");
if(homeButtonWidget){
  //the extent you want
  var extent = window._widgetManager.map.extent;
  //set extent
  homeButtonWidget[0].homeDijit.extent = extent;
}

View solution in original post

2 Replies
TaoRuan
New Contributor

Hi Naty,

The extent property of homeButtonWidget can be set, for details: HomeButton | API Reference | ArcGIS API for JavaScript 3.17

In WAB, you could write your code like this:

//get the reference of HomeButtonWidget
var homeButtonWidget = window._widgetManager.getWidgetsByName("HomeButton");
if(homeButtonWidget){
  //the extent you want
  var extent = window._widgetManager.map.extent;
  //set extent
  homeButtonWidget[0].homeDijit.extent = extent;
}

NatashaManzuiga
Occasional Contributor

Tao, Thank you!!!

Great!!

Naty

0 Kudos