App Connect Bootstrap 4 Collapse Version 2 Support Product Page

Solved

Problem with dynamic accordion

Reported 10 Jul 2020 07:47:54
1
has this problem
10 Jul 2020 07:47:54 rich sale posted:
I have added an accordion to this page seolog.nofuss-des.co.uk/notesb.php

The accordion is populated from the database and the titles and card body content seem to be correct.

But when I click on a header all the cards open.







Replies

Replied 21 Jul 2020 06:44:06
21 Jul 2020 06:44:06 rich sale replied:
Any thoughts on this?

Come on guy's I know you are busy but it has now been 3 weeks
Replied 04 Aug 2020 07:18:40
04 Aug 2020 07:18:40 Teodor Kuduschiev replied:
Hello, all your accordion items have the same ID and all the accordion headers point to this ID so it opens all of them at the same time ...
You need to use dynamic IDs for the accordion items and the headers pointing to them.
Replied 04 Aug 2020 13:14:24
04 Aug 2020 13:14:24 rich sale replied:
Thanks Teodor

Is there an example of this?
Can I just bind a unique value like the id from the record?





Rich
Replied 04 Aug 2020 13:28:56
04 Aug 2020 13:28:56 Teodor Kuduschiev replied:
Well yes you need to exactly this.
You need to add dmx-bind: in front of the attribute you want to make dynamic. Examples:



dmx-bind:id=" 'id_projnote_collapse' + dynamic_part"
data-target=" '#id_projnote_collapse' + dynamic_part" 



where dynamic_part is the dynamic binding/id returned by your query/repeat. It should not be wrapped in quotes, just replace the dynamic_part with your dynamic value as it is in my example.
Replied 04 Aug 2020 13:57:10
04 Aug 2020 13:57:10 rich sale replied:
I think I did this but obviously got it wrong.
Can you take a look at the test page and tell me what I missed.
Replied 04 Aug 2020 15:39:05
04 Aug 2020 15:39:05 rich sale replied:
OK eventually, by trial and error, figured it out.

You have to remove the is="dmx-bs4-collapse" to make it work !!!

Not easy to fathom out without any real instructions.

Thanks for your help anyway

Reply to this topic