Configure weather widget

1450
0
05-18-2017 12:20 PM
VadimShu
New Contributor

Hello all,

I use Operations Dashboard, and use weather widget from dashboard-samples/weatherWidget at master · Esri/dashboard-samples · GitHub 

The widget as is runs very well - I have wundreground key and can add it to my operation view.

Then I try to add configuration page to the widget.

I do next:
- in manifest weather.json I changed the title, and added


   "path": "WeatherWidgetConfig.html"

- I created simple WeatherWidgetConfig.html
- I created simple WeatherWidgetConfig.js file with only
hostReady: function ()
{
this.readyToPersistConfig(true);
}

Now when widget started I in debugger in weather.js hostReady see that this.mapWidgetProxy === undefined.

Then I try next modifications to hostReady:

hostReady: function ()
{
var self=this;
this.getMapWidgetProxies().then(
   function(mapWidgetProxies){
   console.log("getMapWidgetProxies", mapWidgetProxies[0]);
   self.config.mapWidgetProxy = mapWidgetProxies[0];
   self.readyToPersistConfig(true);
},
function(err){console.log(err);});
}...

now in weather.js hostReady I see that this.mapWidgetProxy has value, but nevertheless
this.mapWidgetProxy.subscribeToMapEvents();
failed (endless cycle).

How can I receive valid mapWidgetProxy from configuration page?

I attached source files.

Thank you in advance.

Vadim.

0 Kudos
0 Replies