I'm trying to call an eSearch function from eLocate. I want to take the point from the eLocator and send it to the eLocate search function. It seems to recognize eSearch, but it keeps saying "eSearchWidget.search is not a function".
Here's my code:
eLocate:
showlocation:
//Open point in eSearch
var widgetCfg =
this._getWidgetConfig('eSearch');
if(widgetCfg){
var eSearchWidget =
this.wManager.getWidgetByLabel(widgetCfg.label);
if(eSearchWidget) {
this.wManager.openWidget(eSearchWidget);
eSearchWidget.search(ptGraphic.geometry,0);
}
}
It places the graphic on the page, the infowindow appears and it gets all the way to the eSearchWidget.search line and then it errors out. I must be missing something??
Solved! Go to Solution.
Tom,
That code looks good as long as the eSearch widget has already been loaded (opened and initialized). If the eSearch has not been loaded then the getWidgetByLabel will return null for eSearchWidget.
Tom,
That code looks good as long as the eSearch widget has already been loaded (opened and initialized). If the eSearch has not been loaded then the getWidgetByLabel will return null for eSearchWidget.
I was so dumb. I had changed the label of eSearch to "Search", so getWidgetByLabel was opening another widget which had a label of "Search". So obviously it couldn't find any functions in the wrong widget. At least you confirmed that the code was correct event though my execution was faulty. Thanks.