How to have "List with columnar slidings cards" expanded by default?

Dear community,

How can I have the list-block “List with columnar sliding cards” expanded by default? In the current Softr these are collapsed by default (and may be expanded when clicked on).

Can anyone help with custom-code perhaps?

Thanks, regards,
Thijs

Hi @thijs do I understand you correctly that you want it to always be expanded so you don’t have to click to expand? if so then why not using one of the List with horizontal cards blocks(without slider) and just use a “divider” field to divide fields?

Hi Maria,

Thanks for you suggestions, it seems very intuïtive that the divider should split the datafields in ROWS, but that’s not the case… I tried them but I can’t find anything suitable:

Hi @thijs try using the custom code bellow. You need to put it in your page settings → Custom Code → Footer section, replace the BLOCKID with your block name, save and preview.

<script>
window.addEventListener('block-loaded-BLOCKID', () => {
    setTimeout(() => {
        let listItems = document.querySelectorAll('#BLOCKID .horizontal-list-item');
         [...listItems].forEach((item) => {item.click();})
    }, 1000)
})
</script>
1 Like

Hi Astghik,

Thank you! But unfortunately, it doens’t work… I see the list expand for a micro-second, and then immediately collapse again!?

Contacting you DM to check

Hi Astghik,

Thank you very much! To the benefit of the rest of the community this is the code you shared with me to have the “list with columnar sliding cards” expanded by default:

<script>
let clicked = false;
window.addEventListener('block-loaded-BLOCKID', () => {
         setTimeout(() => {
             if(!clicked){
                let listItems = document.querySelectorAll('#BLOCKID .horizontal-list-item');
                 [...listItems].forEach((item) => {
                    item.click();
                 }) 
                 clicked = true;
            }
         }, 1500)
})
</script>
2 Likes

Hey guys, @Astghik
I have the same problem but with the “List with columnar sliding cards”. Do I need to replace the “.horizontal-list-item” with another name for that code block to make it work? :slight_smile:

Hey @Tim_ClimatEU, no it will work for your block as well, just replace the BLOCKID :sunglasses:

1 Like

So it would be:

<script>
let clicked = false;
window.addEventListener('block-loaded-table2', () => {
         setTimeout(() => {
             if(!clicked){
                let listItems = document.querySelectorAll('#table2 .horizontal-list-item');
                 [...listItems].forEach((item) => {
                    item.click();
                 }) 
                 clicked = true;
            }
         }, 1500)
})
</script>

In the footer of the page?

1 Like

Yes :star_struck:

Hmm, it’s not working for me :smiley:

I’m trying it here:

DM-ing you

@Tim_ClimatEU @Astghik

Were you able to get this working? I have exactly this problem, I would love for all the collapsed “List with horizontal cards” blocks to be expanded by default and if possible, never collapsed.

Eager to hear if you found a solution.

Hi @Roper, yes we were, can you please try to increase the Timeout interval to 2000?

Thank you @Astghik I’ll give that a try. I’m a little skeptical that this will be my solution. I have a page that allows me to display client account details from a set of linked Airtable records. Each account is displayed in a Block “List details page with 3 column view” … which is great because it’s always displayed. But, because I need to list “linked” Household Members, Homes, Cars, etc; we have to use Block “List with columnar sliding cards” … which defaults to collapsed; and because of the “Item Click On” action, it makes the text difficult to copy/paste from.

I’d love to have a format that had every Account Record and their Linked Records always displayed, maybe even easily printed to PDF.

I’ll try to implement the script but I’m worried it’ll be very difficult to trigger so may “script clicks” on a complex set of block.

Do you have any suggestions on other formats to accomplish this scheme?

Account
↳ Household Members
↳ Homes
↳ Vehicles

Thx again.

Roper

==
Roper@SignatureAdvisor.com