File Manager: Requests and Responses for Different Operations

On the page ‘Requests and Responses for Different Operations’ (https://docs.webix.com/file_manager__loading_data.html#requestsandresponsesfordifferentoperations) is written from ‘The response is any valid JSON’.
What’s the use? And what must in the JSON for undelete the item?

The “valid JSON” assumes just a proper format of the response - FileManager is not intended to work with other data formats, such as XML. Removing an item does not require a specific confirmation.

And what must in the JSON for undelete the item?

Basically, if deleting is forbidden you can just throw an error from the backend - in such case, FileManager will reload the data and restore the item on the client side.

For more information on the topic, please check the related discussion.

How can I throw an error from the backend to webix?
I don’t understand this part.

How can I throw an error from the backend
Depends on the backend, I mean any common error. In PHP, you can use a common

header('HTTP/1.0 500');

to get the 500 error on the client side. It will trigger onErrorResponse event and reload the data instantly (if it is not prevented by returning false from this event).

As an option, you can trigger data reloading manually.
To do so, you need to return a JSON object with a custom flag that will indicate an “error” and detect it in onSuccessResponse

{ "status":"error"  }

and set the corresponding event handler

on:{
	onSuccessResponse(request, response){
		if (response.status && response.status === "error"){
			this.clearAll();
			this.load("../common/data.php");
			return false;   // prevent further callback processing
		}
	}
}