DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
390 stars 193 forks source link

Deep Nested Repeaters and setList #35

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello, thanks for the plugin. I hope I am adding this issue correctly so if there are any issues please let me know.

I have been toying with an odd issue when mixing deep nested repeaters (repeater->nested->nested) with the fairly recent setList option that was implemented. The issue arises after setting the list a duplicate of the inner repeater is appearing inside itself.

I've put together a pen to demonstrate:

http://codepen.io/anon/pen/pEYdxZ

You will see in the example that the inner repeater "trousers" appears twice (below itself).

The code is all copied straight from the github readme page but is it possible that I have something wrong with my HTML / setList?

Thanks.

DubFriend commented 7 years ago

Hmm yea definitely looks like a bug. I implemented the setList pretty hastily I didn't test deep nesting with it. I can take a look hopefully later this week. Thanks :smiley:

ghost commented 7 years ago

Any progress on this one? I just came back around to looking at jQuery repeaters and forgot about this issue.

xadamxk commented 7 years ago

Kyle, are you able to get repeating lists working at all? Even without the setList, I can't seem to get nested repeaters working. (A bit new to Github, hopefully I'm replying where I should be)

deep0209 commented 6 years ago

I am also facing the same issue while using setList with nested repeaters. Any updates for this?

nytmo commented 6 years ago

Would really appreciate this one resolved.

kypergio commented 6 years ago

In my case it was because I had "initEmpty": true in the nested parameters, and it seems doesn't work with setList in nested repeater. If anyone needs it.

var repeater = $('.repeater').repeater({
                show: function () {
                    $(this).slideDown();
                },
                hide: function (deleteElement) {
                    $(this).slideUp(deleteElement);
                },
                initEmpty: true, // It's from parent repeater
                repeaters: [{
                    **initEmpty:true, // I removed this**
                    selector: '.repeaterProducto',
                    show: function () {
                        $(this).slideDown();
                    },
                    hide: function (deleteElement) {
                        $(this).slideUp(deleteElement);
                    }
                }]
            });
gordios commented 4 years ago

i have same issue with deep nesting repeater about setList.