Problem refreshing id of file in filemanager

Hi, how can i get all items of a folder?. Then problem is that I´m using a proxy in the handles of fm, but when i put the proxy in downlaod handler, i get the error

TypeError: url.indexOf is not a function
webix.js:30139:40
_get_active_url http://10.2.1.135/intrahcg/webix/codebase/webix.js:30139
send http://10.2.1.135/intrahcg/webix/codebase/webix.js:15897
addFile http://10.2.1.135/intrahcg/webix/codebase/webix.js:30123
_add_files http://10.2.1.135/intrahcg/webix/codebase/webix.js:30075
render http://10.2.1.135/intrahcg/webix/codebase/webix.js:15786
bind http://10.2.1.135/intrahcg/webix/codebase/webix.js:298

​So my solution was set the url in the handler. Then I manage all responses in the event onSuccessResponse, but doing that with the download i can´t get the response from server in that event so i’m getting the response in the event onAfterFileUpload but the biggest problem is that when i upload a new file, fm assigns an id, but when i try to download i get an error cuz the id doesn´t exist in my DB. So i need to refresh the whole tree cuz laodBranch doesn’t work.

Hey @Dalaz, unfortunately, it is not possible to customize downloading via proxy (as you might’ve already experienced this yourself). As for your issues with file downloading, I’m assuming that you are talking about this case: you upload a file → it gets assigned a local id by the file manager itself → your backend assigns an id for your newly uploaded file and overrides the local id, but when you try to download the file, it is getting the local id instead of the correct id on the backend, is that right? In that case you could try and use the waitSave API which is going to wait for the server response, and after that you can include your download operation with the correct id:

$$("fm").waitSave(function(obj) {
 this.download(obj.id)
})

If I’m wrong about your case, please correct me.

Yes, that’s correct, now with the event after upload i can’t get the id of the file uplaoded but the problem it would be find the new file and replace the file.

The second problem is, what if i drag & drop several files, with waitSave could I get all the responses?

An option could be load again that branch but loadBranch doesn’t refresh the items

You can get the config of the uploaded file with the help of onBeforeFileUpload event, this way, you can get the uploaded file id: https://snippet.webix.com/n0owcnoj.

It could work but, if I use onAfterUpload to get the id from server and I upload several files, i just get one id so i just could change one id of the files uploaded.
Can i refresh the datatable or dataview to load again the files?

As far as I know you can’t really reload just the datatable part of the file manager, since it works based on binding, so you’d have to reload the data for the whole file manager view. To do this, you can use load.

Also, perhaps I don’t quite get it, but I’m not sure why you can’t get all of the changed ids when you are uploading multiple files. By using onBeforeUpload if you upload multiple files you will get a return for every file that you’ve uploaded, hence why you could get the id of every file as well this way.

Yes, i get the id that fm set to the new file, the problem is on the server response, i just get first id that i generate

Well the problem was onAfterUpload , I use onFileUpload uploader event and i get from server all ids, so problem resolve