Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional search actions #5471

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion contribs/gmf/src/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,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 @@ -170,7 +171,8 @@ exports.component_ = {
'additionalListeners': '<gmfSearchListeners',
'maxZoom': '<?gmfSearchMaxzoom',
'delay': '<?gmfSearchDelay',
'onInitCallback': '<?gmfSearchOnInit'
'onInitCallback': '<?gmfSearchOnInit',
'searchActionCallback': '&?gmfSearchAction'
},
controller: 'gmfSearchController',
templateUrl: gmfSearchTemplateUrl
Expand Down Expand Up @@ -308,6 +310,11 @@ exports.SearchController_ = class {
*/
this.onInitCallback;

/**
* @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 @@ -980,6 +987,10 @@ exports.SearchController_ = class {
const silent = !!featureGeometry;
this.gmfTreeManager_.addGroupByLayerName(actionData, true, silent);
}
} else {
if (this.searchActionCallback) {
this.searchActionCallback(action);
}
}
}
}
Expand Down