Search code examples
javascriptjqueryms-officeelfinder

Elfinder On dblClcik


Am using Elfinder Plugin in my website and what i need when i double click on the file, to open it on another windows with Office Web Viewer.

On the Select Even, i Did it like below:

 $('#elfinder').elfinder({ 
                url : "php/connector.minimal.php?id='.$id.'&level='.$level.'&office='.$office.'",
                    lang : "ar",
                handlers    : {
                    select : function(event, elfinderInstance) {
                        var selected = event.data.selected;
                        if(selected.length > 0){
                           var file = elfinderInstance.file(selected[0]);
                           window.open("https://view.officeapps.live.com/op/view.aspx?src=http://e-lawyer.co/elfinder/files/"+elfinderInstance.path(selected[0])+"&embedded=true", "_blank");
                        }
                    }
                }
});

I need to do the same thing but On Double Click Event

Any help please ?


Solution

  • There is an option getFileCallback of client configuration option.

    $('#elfinder').elfinder({ 
        url : "php/connector.minimal.php?id='.$id.'&level='.$level.'&office='.$office.'",
        lang : "ar",
        getFileCallback : function(file, fm) {
            var url = fm.convAbsUrl(fm.url(file.hash));
            window.open('https://view.officeapps.live.com/op/view.aspx?src='+encodeURIComponent(url)+'&embedded=true', '_blank');
        }
    });