I have a default search widget.
When I click on a button in another widget , i want to clear the results from the search widget. Below is how I tried but not clearing the text from the search widget. Can I call the method(_onClearSearch) of the search widget from the other widget? Any ideas?
let _searchWidget = this.widgetMan.getWidgetsByName('Search');
on.emit(query(".searchClear"), 'click', _searchWidget[0]._onClearSearch);
Thanks for your help!
The code should look like this:
let _searchWidget = this.widgetMan.getWidgetsByName('Search');
on.emit(query(".searchClear"), 'click', lang.hitch(this, function(){
_searchWidget[0]._onClearSearch();
}));
Thank you Robert!
I tried as you mentioned , but still not firing the _onClearSearch method.Anything else I am missing?
let _searchWidget = this.widgetMan.getWidgetsByName('Search');
on.emit(query(".searchClear"), 'click', lang.hitch(this, function(){
_searchWidget[0]._onClearSearch;
}));
I edited my code post (above) to actually invoke the method. Try that.