Update (2015/09/25) :
- correction of conflict between WAB >= 1.1 and the widget on load (extent from URL params)
Now, the widget is fully compatible with WAB standard URL params.
Hi,
I made a widget to deal with URL parameters.
It tracks extent changes and put them in url.
Then the user can use his browser's return and forward buttons to go to previous or next extent.
Of course, if extent parameters are in url on map's loading, the map is centered.
The widget communicates with other widgets :
- listen to widgets "asking" to put parameters in url.
- send parameters changes to other widgets (when browser's return and forward buttons are used or when an other widget has asked to put parameters in url).
Github :
magis-nc/esri-webappbuilder-widget-url · GitHub
Last release :
Release Release v1.3.2 (debug) · magis-nc/esri-webappbuilder-widget-url · GitHub
And widget zip (release v1.3.2):
https://github.com/magis-nc/esri-webappbuilder-widget-url/archive/v1.3.2.zip
Jeremie,
Thank you for posting this widget. I'm using WAB Dev 1.1 and I have: added url folder to client/stemapp/widgets directory, added url into client/stemapp/widgets/list.json, and added url to the client/stemapp/config.json. Here is how I added it to the config.json (this maybe wrong):
,{
"uri" : "widgets/url/Widget",
"positionRelativeTo" : "browser"
}
I am testing this in Chrome Version 42 and IE 11 and it does not seem to be working. Any idea what I'm missing?
Thank you,
Leighton
Leighton,
The folder must be Url and not url.
In wab >= 1.1, you must copy the config.json file (with Url widget) in client\stemapp\predefined-apps\default folder.
Jeremie,
Thank you for your prompt reply. It is still not working.
As you suggested, I changed url to Url and to client\stemapp\predefined-apps\default, I added:
,{
"uri" : "widgets/Url/Widget"
}
Restating what I have done I: 1) added your Url folder to client\stemapp\widgets directory, 2) added Url into client\stemapp\widgets\list.json, 3) added Url to the client\stemapp\config.json, and 4) added Url to client\stemapp\predefined-apps\default\config.json. Here is how I added it to both config.json files (under "widgetOnScreen"):
, {
"uri" : "widgets/Url/Widget"
}
One other thing, I'm developing this on a development server and the server (site) certificate is not trusted. Could this be the problem?
Any other ideas what I'm missing?
Regards,
Leighton
Hi - Can you provide an example of how the URL should look like? I plugged in the params like this :
https://XXXX.com:3344/webappbuilder/apps/2?center=-116.972,32.662,3857&scale=300
and
https://XXXX:3344/webappbuilder/apps/2/?extent=33.288305,-116.620913,33.288305-116.620913,3857
and it doesnt work.
If the widget is active (and widget's config doesn't desactivate the extent tracking), your ulr should change at every extent change.
Are you sure the widget is added in your app ?
I was able to get it working but the URL I was trying to launch the app was different from the URL that was appended by the widget when the extent changed.
The URL I was trying to launch the app with:
https://XXXX:3344/webappbuilder/apps/2/?extent=33.288305,-116.620913,33.288305-116.620913,3857
and the URL appended by the widget:
https://XXXX:3344/webappbuilder/apps/2/?extent=-13023042%2C3849813%2C-13016791%2C3852689&
Is there a conversion needed?
The widget works with map's projection.
Until WAB version 1.1, WAB supports passing center or extent in url :
Use URL parameters—Web AppBuilder for ArcGIS | ArcGIS
Passing extent in geographic coordinates should work but i my widget interfere with WAB standard comportement. I will correct that as soon as possible.
Thank you!
Just curious...Does the data in the publishData method of this Widget need to be modified so a Search widget can read the params and zoom?
You don't have to modify the Url's widget.
Your search widget has to make calls to publishData to send params to the url with an object like that :
{
"toUrl":{
"params":{
"mySearch":"mySearchString"
},
"eraseMode":false
}
}
And to listen to the changes in url, you have to :
- listen to Url's widget with a call to fetchDataByName("Url") on your startup
- implement the onReceiveData method in your widget and make your logic when receiving params from Url's widget.