Possible dataTables.editor.js improvement

Possible dataTables.editor.js improvement

Josh_BrooksJosh_Brooks Posts: 11Questions: 4Answers: 0
edited June 2015 in Free community support

I was looking through the dataTables.editor.js code and I noticed the information message on the Editor gets hidden, but never cleared out. This causes a fade out effect sometimes when I bring up the editor again and intend to have an empty info message. Could you modify the dataTables.editor.js code to clear out the old information message when its no longer needed rather than hide it?

Editor.prototype._message = function ( el, msg )
{
    if ( ! msg && this.s.displayed ) {
        // Clear the message with visual effect since the form is visible
        $(el).fadeOut();
    }
    else if ( ! msg ) {
        // Clear the message without visual effect
        el.style.display = "none";
    }
    else if ( this.s.displayed ) {
        // Show the message with visual effect
        $(el).html( msg ).fadeIn();
    }
    else {
        // Show the message without visual effect
        $(el).html( msg );
        el.style.display = "block";
    }
};

Replies

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin

    Hi,

    Thanks for the suggestion! I don't see any issue with implementing that (other than a few extra bytes :-) ):

    Editor.prototype._message = function ( el, msg )
    {
        el = $(el);
    
        if ( ! msg && this.s.displayed ) {
            // Clear the message with visual effect since the form is visible
            el.fadeOut( function () {
                el.html( '' );
            } );
        }
        else if ( ! msg ) {
            // Clear the message without visual effect
            el.html( '' );
            el.style.display = "none";
        }
        else if ( this.s.displayed ) {
            // Show the message with visual effect
            el.html( msg ).fadeIn();
        }
        else {
            // Show the message without visual effect
            el.html( msg );
            el.style.display = "block";
        }
    };
    

    This will be in Editor 1.5.

    Regards,
    Allan

This discussion has been closed.