Bug? - "Are you sure you wish to delete" message erroneously appearing on "New" and "Edit" form

Bug? - "Are you sure you wish to delete" message erroneously appearing on "New" and "Edit" form

dmcglynndmcglynn Posts: 15Questions: 5Answers: 0
edited December 2015 in Editor

Hello

I have an editor instance where I am using the .on("preOpen") event to prevent the delete prompt from appearing unless a value in the selected row(s) appear in a "safe to delete" array. As per the documentation, I am using "return false" to prevent the editor from opening, and it is working great.

However, now I have the "Are you sure you wish to delete X rows?" message appearing at the top of the NEW and EDIT forms if I press the those buttons.

I assume it is a bug, as if I attempt to delete a row which doesn't return false, and then press the NEW or EDIT buttons, the erroneous "are you sure" text doesn't appear. It seems to only happen after returning false.

I've tested it a few different ways, but this simple code seems to replicate it:

    quoteEditor.on("preOpen", function(e, mode, action) {
        if (action == 'remove') {
            return false;
        }
    });

Thanks,
David

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi David,

    Thanks for posting this. I think this is a bug - it could be debatable since it might actually be desired to keep the dynamic info when using preOpen to cancel the display, but I think your own use case is far more likely, which is why I consider this to be a bug.

    I've committed the fix locally and it will be in Editor 1.5.5, but if you'd like to apply it immediately, in the Editor source find:

        if ( this._event( 'preOpen', [type, this.s.action] ) === false ) {
    

    And immediately after that line (i.e. before the return false;) add:

            this._clearDynamicInfo();
    

    Regards,
    Allan

This discussion has been closed.