List Block Enhancement

This is an important need! And it would be great to have this feature.

In the meantime, as a workaround, it might be possible to get a similar result by setting up an inline filter on the list and then initializing it with a url parameter that matches no results.

1 Like

Thanks that’s a decent hack. Is there a way to do that with the search bar vs inline filter? I only use search bar for input.

I think what you would need to do is add some custom code that clears the inline filter once the user presses enter in the search bar.

Alternatively you could use a url parameter to prefill the search bar with text like “type here to search” which would hopefully match no records in the table. There’s no feature for prefilling the search bar, but if you look in the custom code section of this board there are examples.

ah yes yet another “no-code solution that requires custom code” lol - thanks will check it out

looks like adding this parameter works ?search-for=findme BUT you can’t create a page URL with ? in it so you have to just link to it

Hey @aj_martin,

Please try this code. @matthieu_chateau just edited the code.

<style>
    .hide-records .filters-middle-section {
        display: none !important;
    }
</style>
<script>
    window.addEventListener('get-records-list1:before', (e) => {
        const listClasses = document.getElementById('list1').classList;
        if (e.detail.search || e.detail.filter.length) {
            listClasses.remove('hide-records');
        } else {
            listClasses.add('hide-records');
        }
    });
</script>

Please, replace List1 with block names.

4 Likes

Works like a charm with the search box (only)!

Update: following the snippet change by @Suzie = works with inline filters too!!

I’d like to put this in the snippets repo, but I am not sure I understand it. Can you say exactly what it’s supposed to be doing so I can try testing it?

1 Like

@dcoletta Update: following the snippet change above, by Suzie = works with inline filters too

2 Likes

Thanks @matthieu_chateau, sorry @dcoletta, did not see your question.

Awesome - ty. Hopefully this will be added as an option down the road as to minimize need for custom code.

2 Likes

Hi @matthieu_chateau, @Suzie this is a really great hack. I wondered - because this is something we’ve needed for ages - if there was a way of tweaking it to remove the dynamic search (ie so that the search is not performed until the user presses enter). We’ve long wanted - and it seems like a fairly general requirement - to link users who hold e.g. a coupon to a page where they can enter their coupon number, hit return and see their specific coupon record - rather than seeing every coupon that matches each substring as they create their search term…

Would be great to add as an option here:
Initial Results:
Start with Results | Start with Results based on Conditions (add condition filters below) | Start with Zero Results

:slight_smile: definitely @aj_martin - and perhaps add ‘Use whole search terms only’ as an option to indicate that dynamic search should be disabled and no results will be returned until the user presses enter to submit a whole search term.

Hey @swshrey,

We’ll be able to check this with the team on Monday :slight_smile: Will keep you posted

@Suzie thanks v much for investigating! Hugely appreciated. Currently, we get round this using a dotty workaround where we sign in the user with a generic magic link, embed a third party form that requests a coupon number. The form does a look-up in an external database to match the coupon to an airtable record, then creates an auto-forward on form submission to the url of the Softr details page, with the record ID in the param - which works because the user is still signed in. Eek!

2 Likes

Hi @Suzie - as per a recent chat with @Viktoria I think we came up with a rather obvious solution and kicking myself for not thinking of it earlier - we can simply create a public page with a list details block, and then parameterise the URL with the recordid to display the single record…seems to work :slight_smile: so no need to follow up unless it triggered any other thoughts. It would still be useful to be able to switch off dynamic search results however - so that a data set is only returned when the user completes a search term in the search bar and presses enter.

1 Like

Hey @swshrey,

Thanks for the details, I also discussed with Viktoria and got all the details :slight_smile:

Hey @swshrey,

Thanks for the details, I also discussed with Viktoria and got all the details :slight_smile:

@Suzie script works like a charm. I didn’t even realize I needed this feature until I came across this thread and then I thought to myself - yes, this is the correct user experience in my case (Google-like) - no records fetched on first load, until the user starts typing in the query string.

Thank you!

2 Likes