File manager cancel move operation

edited September 2018 in Technical questions

I would like to know what to return when a move operation can not be completed.

ie. if I drag a file to a folder where it is not allowed to be moved to , what do I return for the file manager to prevent the GUI from showing the file in the new location?

I have tried returning "any valid JSON" as the documentation shows here https://docs.webix.com/file_manager__loading_data.html#requestsandresponsesfordifferentoperations

i tried returning the original id and value :

[
    {"id":"sales\/sales01.doc","value":"sales01.doc"}
]

i tried returning a blank array

[]

i tried the 'ok' array

["ok"]

i tried a 'false' array

["false"]

doesn't matter, the GUI just moves the file any way

How do I cancel the move operation so the GUI doesn't move the file?

Tagged:

Comments

  • The thing is, the client side UI made changes without waiting for the server side response. The component can't undo action, but if server side code results in an error ( response with 500 or similar code ), the component will try to reload its content from the server side ( sync data to actual state )

  • Thank You!

    I used this:

    header("HTTP/1.1 500 Internal Server Error");

    now the file manager reloads and the file is still in its original location. perfect.

    maybe this could be part of a documentation??

  • I also used the onErrorResponse handler to display a message to the user

    https://docs.webix.com/api__ui.filemanager_onerrorresponse_event.html

    fManager.attachEvent("onErrorResponse", function(requestData,response){

                alert("Please Note: Files/folders cannot be moved to another Category");
    
                return true;
    
            });
    
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!