AnsweredAssumed Answered

Search Widget Question

Question asked by CSmith122_nysdot on Feb 7, 2018
Latest reply on Feb 7, 2018 by CSmith122_nysdot

Hi,

 

I am trying to make a Search History widget to archive searches done in the WAB Search widget. I want to make it so that the Search History widget can pass a previous search to the Search widget, and then the Search widget will automatically perform a search on that previously searched term. I am running into a problem passing the data from the History widget to the Search widget. My code in the History widget is:

 

_testPublish:function(search){
this.publishData({"searchString":search);
},

 

In the Search widget, I have added the Search History widgets' name to the listenWidgetsIds array, and I modified its onReceiveData method to handle the data from the History widget. 

onReceiveData: function(name, widgetId, data, hisData) {
if (name === 'framework' && widgetId === 'framework' && data && data.searchString) {
this.searchDijit.set('value', data.searchString);
this.searchDijit.search();
}else if(name === 'History' && data && data.searchString){ // Get text from History Widget and perform the search
this.searchDijit.set('value', data.searchString);
this.searchDijit.search();
}

However, this has not been working. The Search Widget is not populating with the search. In fact, I can't get the onReceiveData method in the Search widget to trigger at all. Are there any simple mistakes that I'm making with this? Or is there a better way to populate the Search widget programmatically with a search?

 

Thanks for your help!

Outcomes