artur
October 20, 2021, 9:15pm
1
Sometimes one needs to open a list page with url parameter that upon opening performs a search based on url parameter. The code below helps to achieve exactly that. (It needs to be inserted into page settings custom code area)
<script>
document.addEventListener("DOMContentLoaded", function() {
const query = getUrlParam('query');
if(query) {
const existCondition = setInterval(function() {
if ($('div.sw-js-list-container').length || $('div.sw-js-single-item-container').length) {
$('.sw-js-list-search-input').val(query);
$('.sw-js-list-search-input').keyup();
clearInterval(existCondition);
}
}, 100);
}
function getUrlParam(name) {
const url = new URL(window.location.href);
return url.searchParams.get(name);
}
});
</script>
1 Like
Can you provide an example URL?
artur
October 21, 2021, 3:42pm
3
1 Like
Is there anyway to select multiple parameters for one query in the URL?
Suzie
August 2, 2022, 1:10pm
5
Hey @dodonerd ,
Unfortunately, it is not possible yet. However, we have it in our future plans
2 Likes
Dan
October 20, 2022, 3:23pm
7
Unfortunately, the code above doesn’t appear to be working within the new studio update
neither does the amended version supplied by @artur shown below
Can we look into this?
As this was working well with our cloud phone system opening up contact details via the url
I know @artur was looking into this but since the Slack channel has been closed not been able to follow up on messages
artur
October 20, 2022, 3:35pm
8
@Dan is your page with List or Table block ?
Dan
October 20, 2022, 4:10pm
9
@artur the page is a list block…
artur
October 20, 2022, 4:33pm
10
@Dan we are looking into this. It’s a newer version of a block (completely changed internally) we will add the filter options soon and let you know
Dan
October 20, 2022, 4:43pm
11
Ok thanks @artur i really believe if we can get this working properly you should look to promote it… intergrating cloud phone systems with Softr makes sense in so many ways for business portals
Thanks again Dan
artur
October 21, 2022, 4:46pm
12
Dan
October 22, 2022, 4:39pm
13
Thanks @artur will give it a try and let you know
1 Like
Dan
October 31, 2022, 6:40pm
14
This code is now working really well @artur and seems much quicker in carrying out a search
1 Like
artur
October 31, 2022, 7:46pm
15
Thanks for letting us know @Dan