You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the onEachFeature function, and then in the controlSearch,
var controlSearch = new L.Control.Search({ position:'topright', layer: featuresLayer, propertyName: 'searchTerm', initial: false, marker: false, minLength: 3, zoom: 16 });
The problem is that both the name and address properties appear in the results and the search bar when a result is clicked. Is there a way to restrict the text in the search bar to just the name property?
If I add:
buildTip: customTip,
to the controlSearch and create the following function:
function customTip(text,val) { return '<a href="#">'+text+'. adjust</a>'; }
then the search results are restricted to displaying just the name (though I can't work out why this might be the case).
The text was updated successfully, but these errors were encountered:
I want to search multiple properties in my geoJSON, namely 'name' and 'address'. I can achieve this using
layer.feature.properties.searchTerm =layer.feature.properties.name + layer.feature.properties.address;
in the onEachFeature function, and then in the controlSearch,
var controlSearch = new L.Control.Search({ position:'topright', layer: featuresLayer, propertyName: 'searchTerm', initial: false, marker: false, minLength: 3, zoom: 16 });
The problem is that both the name and address properties appear in the results and the search bar when a result is clicked. Is there a way to restrict the text in the search bar to just the name property?
If I add:
buildTip: customTip,
to the controlSearch and create the following function:
function customTip(text,val) { return '<a href="#">'+text+'. adjust</a>'; }
then the search results are restricted to displaying just the name (though I can't work out why this might be the case).
The text was updated successfully, but these errors were encountered: