Skip to content

Commit

Permalink
Merge pull request #5463 from camptocamp/search-action
Browse files Browse the repository at this point in the history
Additional search actions
  • Loading branch information
fredj authored Jan 27, 2020
2 parents f6c6ef4 + 03853c4 commit 1f56053
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contribs/gmf/src/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function gmfSearchTemplateUrl($element, $attrs, gmfSearchTemplateUrl) {
* change the style of the feature on the map. Default is false.
* @htmlAttribute {number=} gmf-search-maxzoom Optional maximum zoom we will zoom on result, default is 16.
* @htmlAttribute {function=} gmf-search-on-init Optional function called when the component is initialized.
* @htmlAttribute {function=} gmf-search-action Optional function called when no default action is defined.
* @ngdoc component
* @ngname gmfSearch
*/
Expand All @@ -212,7 +213,8 @@ const searchComponent = {
'additionalListeners': '<gmfSearchListeners',
'maxZoom': '<?gmfSearchMaxzoom',
'delay': '<?gmfSearchDelay',
'onInitCallback': '<?gmfSearchOnInit'
'onInitCallback': '<?gmfSearchOnInit',
'searchActionCallback': '&?gmfSearchAction'
},
controller: 'gmfSearchController',
templateUrl: gmfSearchTemplateUrl
Expand Down Expand Up @@ -352,6 +354,11 @@ class SearchController {
*/
this.onInitCallback = null;

/**
* @type {function(any): void}
*/
this.searchActionCallback;

/**
* Whether or not to show a button to clear the search text.
* Default to true.
Expand Down Expand Up @@ -1042,6 +1049,10 @@ class SearchController {
const silent = !!featureGeometry;
this.gmfTreeManager_.addGroupByLayerName(actionData, true, silent);
}
} else {
if (this.searchActionCallback) {
this.searchActionCallback(action);
}
}
}
}
Expand Down

0 comments on commit 1f56053

Please sign in to comment.