AnsweredAssumed Answered

getDataSourceProxies() throws TypeError

Question asked by bensaunders on Nov 5, 2015
Latest reply on Dec 3, 2015 by bensaunders

I'm trying to get at an external data source within the Operations Dashboard with my custom JavaScript widget - this external data source would be one in addition to the data source configured with my widget. So I'm using the getDataSourceProxies() method on the WidgetProxy class. However, it throws the following error:

 

TypeError
 "TypeError: Cannot call method 'map' of undefined
    at null.<anonymous> (http://js.arcgis.com/3.14/esri/opsdashboard/core/ExtensionBase.js:11:181)
    at http://js.arcgis.com/3.14/init.js:167:296
    at k (http://js.arcgis.com/3.14/init.js:189:431)
    at m (http://js.arcgis.com/3.14/init.js:189:357)
    at resolve (http://js.arcgis.com/3.14/init.js:191:441)
    at a (http://js.arcgis.com/3.14/init.js:190:311)
    at http://js.arcgis.com/3.14/init.js:190:217
    at k (http://js.arcgis.com/3.14/init.js:189:431)
    at m (http://js.arcgis.com/3.14/init.js:189:357)
    at resolve (http://js.arcgis.com/3.14/init.js:191:441)
    ----------------------------------------
    rejected at a (http://js.arcgis.com/3.14/init.js:190:337)
    at k (http://js.arcgis.com/3.14/init.js:190:103)
    at m (http://js.arcgis.com/3.14/init.js:189:357)
    at x.reject (http://js.arcgis.com/3.14/init.js:192:143)
    at a (http://js.arcgis.com/3.14/init.js:190:337)
    at k (http://js.arcgis.com/3.14/init.js:190:89)
    at m (http://js.arcgis.com/3.14/init.js:189:357)
    at resolve (http://js.arcgis.com/3.14/init.js:191:441)
    at a (http://js.arcgis.com/3.14/init.js:190:311)
    at http://js.arcgis.com/3.14/init.js:190:217
    ----------------------------------------
Error
    at then.b.then (http://js.arcgis.com/3.14/init.js:192:253)
    at declare.hostReady (http://localhost:5001/Operations%20Dashboard%20Extensions/MyWidget/MyWidget.js:79:41)
    at l._hostReady (http://js.arcgis.com/3.14/esri/opsdashboard/core/ExtensionBase.js:8:186)
    at http://js.arcgis.com/3.14/init.js:167:296
    at k (http://js.arcgis.com/3.14/init.js:189:431)
    at m (http://js.arcgis.com/3.14/init.js:189:357)
    at resolve (http://js.arcgis.com/3.14/init.js:191:441)
    at a (http://js.arcgis.com/3.14/init.js:190:311)
    at http://js.arcgis.com/3.14/init.js:190:217
    at k (http://js.arcgis.com/3.14/init.js:189:431)" init.js:199

 

The code in my custom widget is:

 

define([
    "dojo/_base/declare",
    "esri/opsdashboard/WidgetProxy"
], function(
    declare,
    WidgetProxy
) {
    return declare("MyWidget", [WidgetProxy], {
        /* Override */
        hostReady: function() {
            this.inherited(arguments);

            this.getDataSourceProxies().then(function(aDataSourceProxies) {
                console.log("Data source proxies:", aDataSourceProxies);
            });
        }
    });
});

 

My manifest file includes "useDataFromView": true. And I indeed have an external data source loaded:

 

 

Any thoughts on how to troubleshoot this? Or am I taking the wrong approach at getting at this external data source from my custom widget?

 

Thanks!

 

Ben

Outcomes