Esri / calcite-maps

A Bootstrap theme for designing, styling and creating modern map apps.
http://esri.github.io/calcite-maps/samples/index.html
Apache License 2.0
239 stars 173 forks source link

Hooking into search for custom popup #220

Closed Wylisc closed 5 years ago

Wylisc commented 5 years ago

So I am trying to create a custom popup when a search result is selected, but I am unable to hide the built in search popup with the following code:

` var searchWidget = new Search({ view: view, popupOpenOnSelect: false });

  searchWidget.on('select-result', function(evt){
    console.info(evt);
    view.popup.open({
     location: evt.result.feature.geometry,  // location of the click on the view
     title: evt.result.name,  // title displayed in the popup
     content: evt.result.extent.center.latitude + " , " + evt.result.extent.center.longitude // content displayed in the popup
    });
  });

`

Specifically the popupOpenOnSelect function isn't being registered and thus the default popup remains. Using ArcGIS api sandbox without calcite and it works as intended so I think something in calcite might be overriding the setting and displaying it anyways.

Any insight into this matter would be greatly appreciated :)

alaframboise commented 5 years ago

You don't need a new search, you need to get the search the app creates. It's in the ViewManager.js. Try applying that code there.

Wylisc commented 5 years ago

Sorry I'm new at this, but where is ViewManager.js?

Wylisc commented 5 years ago

You don't need a new search, you need to get the search the app creates. It's in the ViewManager.js. Try applying that code there.

Basically what I've done is take the Example from the front page and I have been testing that.