AnsweredAssumed Answered

Can A Widget Send Message to LayerList Widget?

Question asked by zhouleizhou on May 12, 2016
Latest reply on May 16, 2016 by zhouleizhou

When I use 2 different publishData functions inside startup () of Widget A, I want to send out the message: ‘ABCD’. See codes below:

 

startup: function() {

this.inherited(arguments);

        this.publishData({ 

               message: 'ABCD'

      });     

        this.publishData({ 

              message: 'XYZ'

      }); 

} // start up ends here

 

Then I set up the onReceiveData function in Layer List widget as the following; I want to receive this signal 'ABCD' from Widget A and display it (I don’t want XYZ to be passed since it will be used for another function). See codes below:

 

onReceiveData: function (name, widgetId, data, historyData) { 

if (name === 'Widget A'&& data.hasOwnProperty(‘ABCD')) { 

alert("The Layer List Widget received the signal ABCD");

    this._clearLayers(); 

    this.showLayers(); 

        } //if ends here

)}

 

But I never see any alert pop up window coming out. Why cann’t my onReceiveData function in LayerList Widget receive this message ‘ABCD’ from Widget A? Many thanks!

Outcomes