Can't remove uploadMany items when using inline editing.

Can't remove uploadMany items when using inline editing.

perrotinperrotin Posts: 39Questions: 9Answers: 1
edited September 2015 in Bug reports

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;
},

Replies

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    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

This discussion has been closed.