Select to view content in your preferred language

setting home widget extent at runtime.

2053
2
Jump to solution
06-29-2016 07:56 AM
NatashaManzuiga
Regular 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
by Anonymous User
Not applicable

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
by Anonymous User
Not applicable

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
Regular Contributor

Tao, Thank you!!!

Great!!

Naty

0 Kudos