Search code examples
grailspreviewelfinder

grails elfinder plugin: preview does not work


I'm using elfinder plugin in my grails project, but I have problems with preview. Infact, if I select one image (gif, png, jpeg) and I try to preview it, I only see a black window. Any suggestion about how to solve this problem?


Solution

  • After several hours of digging finally got the desired result.

    Problem is with the order of js inclusion. Following is my working gsp page

    <!DOCTYPE html>
    <html>
    <head>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css"/>
        <link rel="stylesheet" type="text/css" href="http://elfinder.org/demo/css/elfinder.min.css"/>
    </head>
    
    <body>
        <div id="elfinder"></div>
    
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
        <script src="http://elfinder.org/demo/js/elfinder.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var elf = $('#elfinder').elfinder({
                    url: '${g.createLink(controller: 'elfinderConnector')}'
                }).elfinder('instance');
            });
        </script>
    </body>
    </html>
    

    Ref:- Issue including elFinder and JQuery UI

    You can get working grails application from my git repo: elFinder Demo @GIT