-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
cmb2-attached-posts won't works with CMB2 repeatable fields.
Fields are cloned but not resetted, and there is an error with assigning draggable/droppable jquery-ui to cloned elements.
I solved this way:
if (window.CMBAP) {
jQuery('.cmb-repeatable-group').on('cmb2_add_row', function(event, newRow) {
var app = window.CMBAP;
// draggables
app.cache();
app.makeDraggable();
app.makeDroppable();
// reset
jQuery(newRow).find('.attached-posts-wrap').each(function() {
var $wrap = jQuery(this);
$wrap.find('.attached-posts-ids').val('');
$wrap.find('.retrieved li').each(function() {
jQuery(this).removeClass('added');
});
$wrap.find('.attached li').each(function() {
jQuery(this).remove();
});
app.resetAttachedListItems($wrap);
app.updateReadOnly($wrap);
app.updateRemaining($wrap);
});
app.cache();
});
}👋
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels