webix.confirm -- How do I ask the user if they want to delete

I would like the webix filebrowser to confirm (yes/no) on file delete, and have attached this event handler

fManager.attachEvent("onBeforeDelete", function (id) {

  console.log("delete ?");

  var result = false;

  webix.confirm({
    title: "Alert",
    text: "Are you sure you want to this item?",
    type: "confirm-error",
    callback:function(result){

      console.log('result', result);
      console.log('id', id);

    }
  });

  fManager.getMenu().hide();

  return result;

});

this almost works.
clicking on yes or no makes no difference - file is still deleted.
clicking on yes works - but the filebrowser view is not updated, so the file looks like its still there.

where did I go wrong??

  1. use onBeforeDeleteFile instead of onBeforeDelete
    https://docs.webix.com/api__ui.filemanager_onbeforedeletefile_event.html
  2. in callback check result and deleteFile on success
    https://snippet.webix.com/tjfim9fx

Brilliant! thanks intregal

This is the final handler that now works


fManager.attachEvent("onBeforeDeleteFile", function (id) {

                webix.confirm({
                        title: "Alert",
                        text: "Are you sure you want to this item?",
                        type: "confirm-error",
                        callback:function(result){
                            
                            if(result) {
                                fManager.deleteFile(id);
                            }
                        }
                    });

                fManager.getMenu().hide();
                return false;

            });