Column Modifications

Hello Team

We are using the Vue File Manager from SyncFusion. We are trying to format the file size such that it fits the criteria of KB, MB, GB etc.

https://ibb.co/fSwFgSx   <-- Please see image

We have exposed and attempted to use :detailsViewSettings but we are not able to use the template field to compute our own file size formatting i.e

formatBytes: function (bytes, decimals = 2) {
                console.log("it foes here + " + bytes);
                if (bytes === 0) return '0 Bytes';

                const k = 1024;
                const dm = decimals < 0 ? 0 : decimals;
                const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

                const i = Math.floor(Math.log(bytes) / Math.log(k));

                return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
            },

Is there any suggestions you can provide in order to resolve this.

Thank you

1 Reply 1 reply marked as answer

IL Indhumathy Loganathan Syncfusion Team March 22, 2021 12:48 PM UTC

Hi Milan, 
 
Greetings from Syncfusion support. 
 
We have validated your requirement in FileManager component. We are unable to bind methods directly to template field of detailsViewSettings. By default, we have performed byte conversions for files in FileManager component. Please refer to the below demos. 
 
 
However, you can perform your own byte conversion changes in server side. You can add an additional attribute to our FileManagerDirectoryContent class to maintain the converted byte details. You can pass this modified size in the file operations of FileManager component. We need some additional details on the following to provide you a prompt solution. 
 
1.     Detailed explanation of your requirement. 
2.     Service provider used in your sample. 
3.     Complete code snippets used in your end 
 
Please, let us know if you need any further assistance. 
 
Regards, 
Indhumathy L 


Marked as answer
Loader.
Up arrow icon