We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hide folder?

Hi guys,

Is it possible to hide a listed folder in filemanager?


5 Replies 1 reply marked as answer

FA Farai December 14, 2022 08:46 AM UTC

Anyone available?



PM Prasanth Madhaiyan Syncfusion Team December 14, 2022 03:23 PM UTC

Hi Farai,


Greetings from Syncfusion support.


We understand that you want to hide particular folders in the FileManager component. You can achieve this requirement by passing that folder name in our deleteFiles method inside the success event.


Please refer to the below code snippet.


[index.cshtml]

 

<ejs-filemanager id="filemanager" view="@Syncfusion.EJ2.FileManager.ViewType.Details" success="success" >

    <e-filemanager-ajaxsettings url=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/FileOperations

                            downloadUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download

                            uploadUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload

                            getImageUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/GetImage>

    </e-filemanager-ajaxsettings>

</ejs-filemanager>

 

<script>

 

    function success(args){

 

        setTimeout(function () {

            var filemanagerElement = document.getElementById("filemanager");

            var fileObj = filemanagerElement.ej2_instances[0];

            fileObj.deleteFiles("Videos");

        },1000);

    }

</script>


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CoreFileManager-427232135.zip


For your reference, we have attached the sample. Please check the shared sample and let us know if it meets your needs.


Regards,

Prasanth Madhaiyan.



FA Farai December 25, 2022 03:13 PM UTC

I tried what you suggested. Unfortunately. It has deleted my folders. I'm looking to hide and not delete.



IL Indhumathy Loganathan Syncfusion Team December 28, 2022 02:52 PM UTC

Farai, We don’t have support to hide folders in the File Manager component. However, you can hide the folder by setting hidden attribute for the required folder element. For your reference, we just hide the “Documents” folder. Check out the below code snippet.


function success(args){

    setTimeout(function () {

        var filemanagerElement = document.getElementById("filemanager");

        var elements = filemanagerElement.querySelectorAll(".e-layout-content .e-list-item");

        for(var i=0; i< elements.length; i++){

         if(elements[0].innerText == "Documents")

            elements[0].hidden = true;

        }

    },100);

}


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CoreFileManager2102745060


In a similar way, you can send additional attribute for required folders in server response to hide them within the success event. Check out the shared sample and let us know if you need any further assistance.


Marked as answer

FA Farai December 29, 2022 12:55 PM UTC

Thank you. Just what I was looking for.


Loader.
Up arrow icon