Previous/Next Extent Widget

6052
7
Jump to solution
05-05-2015 08:28 AM
NickHarvey
Occasional Contributor II

Hi All - Does a previous/next extent option exist in any standard or community widget?  If not how would I customize a WAB setup to achieve something similar?  I have located a js api sample that provides this functionality in an esri/map, in a single, simple .html page.  But I'm not sure how to bridge the two (yet)...

-Nick

1 Solution

Accepted Solutions
LarryStout
Occasional Contributor III

Here is a link to the widget you are looking for:

Zoom Prev Next Widget Version 1.1.0 May 10, 2015

Larry

View solution in original post

7 Replies
KevinMacLeod4
Frequent Contributor

To make a widget you just need to put it into the right "declare" 'shell'.  Look at the other widget folders to get an idea of the folder/file structure.  I just started doing this a couple days ago and I am a newbie.  So for your concept of forward/previous extent, I'd just clone the Home widget folder in stemapp, and then just throw the back/forward JS inside it, like so:

  navToolbar = new Navigation(map);

        on(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);

use dojo to attach click handlers to the two HTML DOM nodes (a back and forward image for buttons):

            navToolbar.zoomToNextExtent();

            navToolbar.zoomToPrevExtent();

I may end up writing this in the next few days if you don't whip it up or if it isn't already somewhere else, and if so, I'll be happy to post the code here!

RickeyFight
MVP Regular Contributor

If you are writing your own widget I would look at the sample widgets found at: arcgis-web-appbuilder-1.1\client\stemapp\widgets\samplewidgets

I would suggest adding a button on the bookmark widget to zoom to next bookmark.

NickHarvey
Occasional Contributor II

Thanks Kevin just an update that my rate of progress is not in line with 'whip it up' at present.  I appreciate the tip (and Rickey's) on looking at the folder structure, sample code/widgets and how these interact (now understanding more, very helpful)...But how to structure the code in the widget.js and widget.html vs. this js api sample (below) is not clear, if you have time to assist that would be awesome ....I'm going to keep digging but you're likely to get through it first just a heads up...

thanks

-Nick

Map navigation tools | ArcGIS API for JavaScript

0 Kudos
KevinMacLeod4
Frequent Contributor

Nick if it is not time sensitive to you, I may work on it next week...

-Kevin

NickHarvey
Occasional Contributor II

Sounds good, I have to move on to a couple of requests but if I come back and have a break through first I'll let you know...

thanks!

KevinMacLeod4
Frequent Contributor

Hmm Nick this may be helpful.

URL widget (extent tracking...)

This widget the website overrides control of the browser's native buttons using the webpage back/forward though. I am hesitant to do that, although using the URL for parameters is very interesting and I think can be put to many other uses.  This code may help us. Just fyi. 

LarryStout
Occasional Contributor III

Here is a link to the widget you are looking for:

Zoom Prev Next Widget Version 1.1.0 May 10, 2015

Larry