Search code examples
javascriptjqueryelfinder

Fire Elfinder Error Dialog from Command


I am working on making my own command (view commands) for elFinder, and it works pretty good.

The only thing that I have a problem with is when I do my custom ajax call to the connector, the error doesn't popup. It is valid JSON error output.

I was thinking if it somehow was possible to fire the error dialog myself from the command file?

I'm trying to do this from inside the this.exec = function(data) { ... } function in my command.


Solution

  • Your error call should be like this within that function. this.fm.error() or fm.error() in this case is used to fire the error dialog.

    this.exec = function(data) {
        var fm = this.fm,
        dfrd  = $.Deferred()
            .fail(function(error) {
                fm.error(error);
            })
        return dfrd;
    }