Open tommica opened 7 years ago
The click event is being captured at list level and, for nested repeaters, it happens as many times as deep the nesting is.
Replace that in jquery.repeater.js, towards the end.
$list.on('click', '[data-repeater-delete]', function(event) { event.stopPropagation(); // added this var self = $(this).closest('[data-repeater-item]').get(0); hide.call(self, function() { $(self).remove(); setIndexes($items(), getGroupName(), fig.repeaters); }); });
I also have a similar problem, but when I change the code of the dragosstancu, still repeated the warning: "Are you sure"
Please, give a more detailed example in jsfiddle or codepen about eliminating nested repeaters, since I have this same problem. As I must respond with a different behavior to the slideUp and slideDown of each repeater I need to be able to identify each one: https://github.com/DubFriend/jquery.repeater/issues/98#issue-383246502 Some alternative or it will be that the developer can update this suggested change in a new version.
$list.on('click', '[data-repeater-delete]', function(event) {
event.stopPropagation(); // added this
var self = $(this).closest('[data-repeater-item]').get(0);
hide.call(self, function() {
$(self).remove();
setIndexes($items(), getGroupName(), fig.repeaters);
});
});
Hi guys, All I can do for now is to post a link to my page that demonstrates the nested repeaters: https://demo.webfixtech.com/repeater/
Cool. Thank you for sharing this.
@dragosstancu Thank you for the fix, I hope this gets included in the next release.
$list.on('click', '[data-repeater-delete]', function(event) { event.stopImmediatePropagation(); // add this, It works for me perfectly // event.stopPropagation(); var self = $(this).closest('[data-repeater-item]').get(0); hide.call(self, function() { $(self).remove(); setIndexes($items(), getGroupName(), fig.repeaters); }); });
Thanks @martinmurciego it's save my day.
My JS looks like this:
For some reason when the delete button for an item inside the "in_repeater", it triggers the "Are you sure" confirmation twice.
Everything else works fine!