Can't remove uploadMany items when using inline editing.
Can't remove uploadMany items when using inline editing.
perrotin
Posts: 39Questions: 9Answers: 1
Hi,
When using uploadMany and inline editing (with a trigger button), the remove item button also closes the inline pop up.
I manage to solve this adding e.stopPropagation(); on line 7144 of dataTables.editor.js
fieldTypes.uploadMany = $.extend( true, {}, baseFieldType, {
create: function ( conf ) {
var editor = this;
var container = _commonUpload( editor, conf, function ( val ) {
conf._val = conf._val.concat( val );
Editor.fieldTypes.uploadMany.set.call( editor, conf, conf._val );
} );
container
.addClass( 'multi' )
.on( 'click', 'button.remove', function (e) {
var idx = $(this).data('idx');
conf._val.splice( idx, 1 );
Editor.fieldTypes.uploadMany.set.call( editor, conf, conf._val );
e.stopPropagation();
} );
return container;
},
This discussion has been closed.
Replies
Thanks for spotting that. The issue appears to be that the upload many field's set function immediately rewrite's the DOM, so the inline event handler for closing the field doesn't have a chance to run on the original DOM. I think your proposed solution is best and it has been committed now. Thanks! It will be in 1.5.2.
Regards,
Allan