filemanager data dynamic load

  1. I try to make the actions of file manager as asyn operation. For example, after delete a item (file or folder) within UI, this request should be sent to server firstly, if the result from server is OK, then the item will be removed by the filemanager UI , if the result is fail or timeout, then the item should be still in the UI list. There are the 'Handler' definition which is used for this purpose, but the data structure of the request URL is too strict, not meet our requirements. So can we define custom handlers for (add, remove, rename, branch...) actions? Or there is other way to meet our requirement?

  2. Another one is the api for reload data for filemanager, for example, now after delete item within UI, within 'onBeforeDeleteFile' event callback, I send request to server (ajax async), and then return false(not let UI auto delete the item). After the result sent back from server, I fetch the latest data for filemanager, but only the following way I can update the UI.
    first fm.clearAll() then fm.parse(latestdata)
    If there are big data, this way of updating data will bring negative impact to user, so is there another way for our purpose? I try to use or fm.refresh... not work.

  3. Now only upload a real file, there will be new item within filemanager, so if I want to add new file or folder into the list not by uploading a real file. Like add new custom action labeled as 'add', how to implement this within filemanager?


  • edited May 2018


    (1) File manager data saving logic is async, which is true for all Webix data widgets. But this logic is "positively oriented": the operation is performed in UI, then the request is sent and you can run extra actions when the response is received. For example, you can handle the File Manager onErrorResponse event. By default, the widget just reloads data on error, but you can intercept it and provide your own behaviour - return true or false within the event handler to preserve or cancel the default behaviour respectively.

    As to the custom save handlers, there are 7 of them for different operations: check the related documentation, please. To modify the default behaviour of any handler (except "upload" and "download"), you can define a custom proxy.

    (2) If a custom delete request has been successfully completed, you can simply delete the item from the UI, but ensure that there's no "delete" handler in the "handlers" object: files.deleteFile(id).

    (3) Check the following snippet, please: There you can see a custom "Create file" action in the right-click menu and the corresponding logic in the "onItemClick" handler.

  • (2) I cannot find the function removeFiles. Can you tell me what's this?

  • Sorry for misleading you, the method is called deleteFile.

  • (2) How can I trigger the server side function without delete handler from the event 'onItemClick'?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion