Virtualization in EJ2 TypeScript File manager control

26 Apr 20234 minutes to read

File Manager’s UI virtualization allows you for the dynamic loading of a large number of directories and files in both the detailsView and largeIconsView without degrading its performance.

Module Injection

To use UI virtualization, you must import the virtualization module from the ej2-filemanager package and inject it using the FileManager.Inject() function.

import { FileManager, Virtualization } from '@syncfusion/ej2-filemanager';


Enable Virtualization

The virtualization of the File Manager component is based on the height and width of the viewport. The items will be loaded in both largeIconsView and detailsView based on the viewport size.

In order to enable virtualization, you must set the enableVirtualization property to true.

In the instance below, a sizable collection of files can be found in the folders Documents and Text Documents.

import { FileManager, Toolbar, NavigationPane, DetailsView, Virtualization} from '@syncfusion/ej2-filemanager';

FileManager.Inject(Toolbar, NavigationPane, DetailsView, Virtualization)

let hostUrl: string = '';
// initialize file manager component and add custom item to contextmenu
let filemanagerInstance: FileManager = new FileManager({
    ajaxSettings: {
        url: hostUrl + 'api/FileManager/FileOperations',
        getImageUrl: hostUrl + 'api/FileManager/GetImage',
        uploadUrl: hostUrl + 'api/FileManager/Upload',
        downloadUrl: hostUrl + 'api/FileManager/Download'
    view: 'Details',
    enableVirtualization: true,
    beforeSend: function(args) {
            args.ajaxSettings.beforeSend = function (args) {
                args.httpRequest.setRequestHeader('Authorization', 'FileBrowser');
    beforeImageLoad: function(args) {
            args.imageUrl = args.imageUrl + '&rootName=' + 'FileBrowser';
    beforeDownload: function(args) {
   = 'FileBrowser';
<!DOCTYPE html>
<html lang="en">

    <title>Essential JS 2 File Manager</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Essential JS 2 File Manager Component" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
    <script src=""></script>
    <script src="systemjs.config.js"></script>
<script src="" type ="text/javascript"></script>
    <div id='loader'>Loading....</div>
    <div id="filemanager"></div>

Limitations for Virtualization

  • Programmatic selection using the selectAll method is not supported with virtual scrolling.

  • The keyboard shortcut CTRL+A will only select the files and directories that are currently visible within the viewport, rather than selecting all files and directories in the entire directory tree.

  • Selected file items are not maintained while scrolling, considering the performance of the component.