Calling eSearch function from eLocae

1202
2
Jump to solution
05-09-2016 08:47 AM
TomLeMahieu
New Contributor II

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??

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

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.

TomLeMahieu
New Contributor II

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.

0 Kudos