well, in my case, the params.source in the delete handler contains the id of item to be deleted, not the full path.
Apologies, I’ve made it sound more confusing than it is. Our backend is configured in such a way that every item’s id is equal to its full path, which is why this works for our sample. Incidentally, this could also work as your potential solution (reconfiguring your backend to act in a similar way).
In this case, how can I get the full path which has been delete
Could you please specify if you are calling the following commands via a context menu or are you also making the calls to the API directly?
If you are using the context menu exclusively you could get the correct id with the help of the onItemSelect
event handler (the item gets selected as you call the context menu over it), as previously mentioned, here is an approximate solution - https://snippet.webix.com/dqbg723v (alternative in the case our backend is down - https://snippet.webix.com/pmqs7duv).
An alternative solution agnostic to this condition would be to get the item reference just before it gets deleted via the onBeforeDelete
event handler, here is an example - https://snippet.webix.com/vgu480kf (I am using this sample instead of the one with a backend since our backend is down at the moment, please also note that in this case we are working with item ids that do not consist of its path).
- I used getPathNames and not getPath, which returns ids and not values
The getPath()
method does actually return ids as well, so I’m not quite sure what the issue in your case might have been. The getPathNames()
method returns an array of id-value pairs while the getPath()
method returns an array of ids exclusively.
the rename handler seems to get in the source the id of the new file and in the target the filename of the new file
Is that actually the case? Judging from my limited testing, the “source” parameter points to the id of the original item that was renamed (old file). This can actually be seen from our server-side sample, since the item’s ids depend on the actual name of the file (and its path), so if you were to rename it - its id would change as well. Here is the sample - https://snippet.webix.com/w9tt2qvb. Please note that the “target” parameter points to the old “name” (id) of the file.