Filemanager issues

Hi there,

Nice framework, but I noticed a few issues in the filemanager:

  1. When multiple files/folders are selected and the Action Menu button is pressed an error occurs in modeview.js linenumber 134. See snippet.

  2. Disabling an action in the contextmenu with “disableItem” just makes the action greyed out, but the user can still click on it and the action is then executed. See snippet.

  3. After uploading a file, the correct file icon isn’t shown. In the case of an image the image-icon should be shown. But for now its necessary to reload all the data.

Do you have any workarounds or can you please fix this?

Using:
Webix version 6.4.4
https://snippet.webix.com/1p2g7com

Thanks in advance!

Hey @JvdHoek, let’s go over the issues you are having one by one:

1\. Unfortunately, this seems to be a bug as we have indeed confirmed the issue. Thank you for the report! The fix should be available in the nearest future, most likely the next update, although I can’t provide an exact time frame I’m afraid.

Disabling an action in the contextmenu with “disableItem” just makes the action greyed out, but the user can still click on it and the action is then executed. See snippet.

2\. The reason why this is happening is because the context menu has a special onMenuItemClick event, and disableItem will block this exact event. Meanwhile, the file manager handlers are attached to the onItemClick event, meaning the menu actions will still work just fine. Currently, there is no way to block them completely, but this will be resolved in Webix 7.0.

For the time being, as a workaround, you can either disable the menu entirely, as seen here:

https://snippet.webix.com/1555hdrx

Or, alternatively, you can filter out the unwanted menu items beforehand so they don’t show up at all:

https://snippet.webix.com/1h37ud30

After uploading a file, the correct file icon isn’t shown. In the case of an image the image-icon should be shown. But for now its necessary to reload all the data.

3\. In general, the icon that will ultimately be displayed is set in the templateIcon property, which sets the icons for every type of entity in the file manager (folders, certain types of files). To know which icon to display, by default, templateIcon looks at the type of the provided object.

On the client-side file manager doesn’t know about the type of data that was uploaded, the only way to know this is by receiving a server reponse containing the relevant information (i.e. in the case of an image, the response would return type: “image”). You can try uploading an image and take a look at the response object in one of our examples: https://snippet.webix.com/93le03a9 (you can see the response object in your browser’s DevTools/Network tab).

Although, it is still possible to manually set the type on the client-side, since we do know the extension of the file we are uploading. To do so, you can listen for an onBeforeFileUpload event, which will allow you to gain access to the entirety of the uploaded object. Simply make a check for the relevant file extensions (in our case we only check for the .png, .jpg, .gif extensions) and change the type to image.

Here is the end result: https://snippet.webix.com/55cmzt3e.

Please note that the type has to come from a server response, which will tell the client-side which icon should be used. If the server doesn’t return the type, only then you should consider the provided workaround.

Hi Dzmitry,

Super thanks for the prompt and clear reply!