Open repeater popup if only one search result exists
This commit is contained in:
parent
4f435b7bdc
commit
5467bd4f01
1 changed files with 13 additions and 0 deletions
|
|
@ -915,6 +915,19 @@
|
|||
.then(function (data) {
|
||||
displayRepeaters(data.repeaters);
|
||||
showCount(data.count);
|
||||
if (data.total === 1 && data.repeaters.length === 1) {
|
||||
var r = data.repeaters[0];
|
||||
map.setView([r.lat, r.lng], 14);
|
||||
setTimeout(function () {
|
||||
markerLayer.eachLayer(function (layer) {
|
||||
if (layer.getLatLng &&
|
||||
layer.getLatLng().lat === r.lat &&
|
||||
layer.getLatLng().lng === r.lng) {
|
||||
layer.openPopup();
|
||||
}
|
||||
});
|
||||
}, 600);
|
||||
}
|
||||
renderRepeaterList(searchListEl, data.repeaters);
|
||||
if (data.total > data.count) {
|
||||
var msg = document.createElement("div");
|
||||
|
|
|
|||
Loading…
Reference in a new issue