onBeforeRun Event, JavaScript Programming Example of onBeforeRun Event in File Manager

JavaScript onBeforeRun Event

If you want to predefine the abilty to prevent file downloading in File Manager, use the programming example below. You are welcome to use free coding samples by Webix for creating custom business web apps.

JS Code

var count = 1;
webix.ready(function(){

  webix.ui({
    view:"filemanager",
    id:"files",
    url:"https://docs.webix.com/samples/64_file_manager/common/data.php",
    handlers: {
      download: "https://docs.webix.com/samples/64_file_manager/common/data.php"
    }
  });

  $$("files").attachEvent("onBeforeRun",function(id){
    webix.confirm({
      text:"Do you want to download this file?",
      ok:"Yes",
      cancel:"No",
      callback:function(result){
        if(result)
          $$("files").download(id);
      }
    });
    return false;
  });
});