Dynamically select partial

Is it possible to dynamically select which partial I would like to use lets say I have a partial called row and one called column that use the same data. then im thinking about referencing these in a repeat on a content page both rows and columns use the same data but the designs are different there could be 100s of these designs in the future only other way I can think is conditions on sections.

Any ideas?

I don’t completely understand the requirement here, but using partial inside repeat is not what its built for.
The code for partials, if you take a look in code view, is a server side binding in Wappler. What that means is it will be replaced before the page is rendered on the browser and before any repeats etc are applied.
So, all the partials you have included, will get included on the page.

You could theoretically use CR to manage which partial should get shown in the repeat, but I am not sure what your requirement is here.

Essentially I’m wanting for in the repeat to be able to show any content in my partials in any order so for example a row column then a row or column column row etc etc they use the same data but different layouts for the content I was hoping I could just include the needed code from in the partial I needed rather than generating excess html per time it repeats

Since the repeat is client side, there is no option but to let it generate & repeat HTML.
The best option to manage performance is to use CR.
So inside repeat, put all types’ HTML inside a CR each. Then in repeat, only one CR would actually get rendered on the browser. You will see multiple DIVs created for each repeated row. But performance should be fine.

There is no need of partials.

1 Like

This was my initial thought but was worried about too much excess html thanks for clarifying it wouldn’t be a issue

To give you more confidence, we just created a similar structure like 4 days ago where we use the same logic. We have 8/9 different type of CRs. And two of them also have Swiper element in them. Everything works great and smooth.

I would have thought using a large number of Conditional Regions might not be ideal. If I understand your question correctly, it’s related to a question I asked a couple of years ago which unfortunately didn’t get much response. It’s also related to a feature request made by @aschoijett, which again didn’t get much response (but I think it was a very good suggestion).

I assumed it wasn’t possible with Wappler, but I was interested in this thread where it seemed @patrick offered a solution. I couldn’t get it to work and didn’t get round to following it up. It might be a solution (if it is in fact related to your question).

Thanks for the advice and I agree with the feature request as I can get the simple text binds to work in the inner html but things like button clicks and dmx-show don’t seem to work this was the first way I was attempting it but this issue meant I’d have problems down the line