Closed acerosillo closed 3 years ago
Hi, this is more js question. Such a lib https://medialize.github.io/URI.js/ may help you with parsing url parameters (if you are doing it on the frontend side)
I have this :
computed: {
searchResult: function () {
var uri = window.location.href.split('?');
//if URL has params filtered from params passed.
if (uri.length == 2) {
var result = itemsjs.search({
query: this.query,
filters: this.filters,
prefilter: function(items) {
return items.filter(item => {
//This is where I will pass in my parameters from URL eg. ?careerssearch=&Job_family_group=2&Organisation_name=0&Primary_location_country=GB
return item.Primary_Location_Country == "US";
})
}
})
}
//if URL has no params list as nomarl...
if (uri.length == 1) {
var result = itemsjs.search({
query: this.query,
filters: this.filters
})
}
return result
}
}
this works, but can't get the checkbox to be checked.
I am closing because this is more Vue.js related question
Hi guys,
I have a URL that is passing some parameters (strings), that I want the search page to have filtered when you land on the page :
v-careers-search-page.html?careerssearch=xxx&Job_family_group=xxx&Organisation_name=xxx&Primary_location_country=GB
so for example when I land on the search page, I would like the 'Primary_location_country' checkbox to prefilter all GB countries, but also be able to filter any other options given from GB
hope this makes sense..
cheers, A