Articles in this section

How to hide folder/file from both navigation and main layout of the JavaScript File Manager?

This article explains how to hide folder/file from both the navigation and the main layout of the JavaScript File Manager

Step 1: Implement File Manager component using our getting started documentation.


Step 2: To achieve hiding the file/folder from both navigation and main layout of the JavaScript File Manager component, you can utilize the help of File Manager fileLoad event and set the display style as none for the file/folder element within it.

 

[index.ts]

…

    let fileObject: FileManager = new FileManager({

        …

        fileLoad: function(args: FileLoadEventArgs){

            if (args.module =="NavigationPane"){

                setTimeout(function(){

                    // Find all elements with class e-list-text

                    var listItems = args.element.querySelectorAll('.e-list-text');

                    // Loop through each list item

                    listItems.forEach(function(listItem) {

                        // Check if the list item text is "Documents"

                        if ((listItem as any).innerText === 'Documents') {

                            // If it is, hide the parent list item

                            var listItemParent = listItem.closest('.e-list-item');

                            (listItemParent as any).style.display = 'none';

                        }

                    });

                },0)

            }

            else if(args.module=="DetailsView"){

                setTimeout(function(){

                    // Find all elements with class e-fe-text

                    var fileNames = args.element.querySelectorAll('.e-fe-text');

   

                    // Loop through each file name element

                    fileNames.forEach(function(fileName) {

                        // Check if the file name is "Documents"

                        if ((fileName as any).innerText === 'Documents') {

                            // If it is, hide the parent row

                            var row = fileName.closest('.e-row');

                            (row as any).style.display = 'none';

                        }

                    });

                },0)

            }

           

        },

    });

    fileObject.appendTo('#filemanager')

 

Screenshot:


Conclusion 

We hope you enjoyed learning about how to hide folder/file from both navigation and main layout of the JavaScript File Manager.

You can refer to our JavaScript File Manager feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript File Manager example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsBoldDesk Support, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied