Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A sample that works that includes panel accordion? #96

Closed
martinmurciego opened this issue Sep 14, 2018 · 1 comment
Closed

A sample that works that includes panel accordion? #96

martinmurciego opened this issue Sep 14, 2018 · 1 comment

Comments

@martinmurciego
Copy link

I know it's duplicated
https://github.com/DubFriend/jquery.repeater/issues/66#issue-254551573

But I need an example, if someone has it in jsfiddle / codepen because I need to finish a module of a web app for the University.
Problem: Clone accordion panels within another accordion panel but only the first one can deploy it and the rest does not, it is as if the content was only created for the panel-body of the first panel-body.

It seems to me that maybe there is no support for cloning acordion panels since these handle attributes such as id instead of name, it is my suspicion that I do not know what the problem is.

My code and markup html is something complicated to reproduce it as is.
But: https://jsfiddle.net/martinmurciegomartinmurciego/h0t7uc18/3/

Bootstrap 3.3.7
jQuery 3.2.0

@martinmurciego martinmurciego changed the title A sample that works that includes panel accordion A sample that works that includes panel accordion? Sep 14, 2018
@martinmurciego
Copy link
Author

I was able to solve the problem I had by changing the value of the id attributes of each panel by adding them an element index. The jsfiddle does not try hard to work, but then I update it. My case is a bit more complex because of what it includes but it is rare that the jsfiddle does not show well

            var $repeater = $('.repeater').repeater({
                initEmpty: false,
                defaultValues: {},
                show: function() { //al agregar item con .slideDown()
                    var selfRepeaterItem = this;
                    $(selfRepeaterItem).slideDown();

                    var repeaterItems = $("div[data-repeater-item]");
                    $(selfRepeaterItem).attr('data-index', repeaterItems.length - 1);
                    $(selfRepeaterItem).find('a  h4 span.repeaterItemNumber').text(repeaterItems.length);

                    var aheadingItemId = '#headingItem' + repeaterItems.length;
                    $(selfRepeaterItem).find('a.panel-heading').attr('id', aheadingItemId).attr('href', '#collapseItem' + repeaterItems.length).attr('aria-controls', 'collapseItem' + repeaterItems.length);

                    $(selfRepeaterItem).find('#collapseItem').attr('id', 'collapseItem' + repeaterItems.length).attr('aria-labelledby', 'headingItem' + repeaterItems.length);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant