Ooops, sorry everyone, I meant dropdown list - not a menu.
It is just the list that Knack has in the map - and I would like to add more distances to increase the search radius.
Thanks so much!
Ooops, sorry everyone, I meant dropdown list - not a menu.
It is just the list that Knack has in the map - and I would like to add more distances to increase the search radius.
Thanks so much!
Glad it was helpful :)
Ah, now I see. Got it - just ignore my previous comment. I had a coffee and everything became clear - usually works!
Thanks so much - feeling like a geeeeenious now......but all credit to you Justin!
Thanks for your reply.
I got it to work :) and I can customise the list how I like, BUT....it doesn't seem to understand to modify the search radius.
For example, if I change 2 to 2 miles, it will still search for 2 miles, but if I change 2 to 100 km, it still searches for 2 miles. Is there a way we change the distance it is actually searching across?
Clear the options and add your own :) just swap your view# and the key value pairs in newOptions to suit your needs
$(document).on("knack-view-render." + "view_61", function(event, view, data) {
$(document).ready(function(){
//var select = $('#view_61 > form > div > div > div > select');
var newOptions = {
"select": "1",
"2 miles": "2",
"3 Miles": "3",
"5 Miles":"5",
"10 Miles":"10",
"15 Miles":"15"
};
var $el = $("#view_61 > form > div > div > div > select");
$el.empty(); // remove old options
$.each(newOptions, function(key,value) {
$el.append($("<option></option>")
.attr("value", value).text(key));
});
$( "#view_61 > form > div > input" ).click(function() {
var selected = $('#view_61 > form > div > div > div > select option:selected').val();
$("#view_61 > form > div > div > div > select").val(selected);
});
});
});