Configuration

This section describes options that configure the FileManager widget's contents, behavior, and appearance.

See Also

accessKey

Specifies the shortcut key that sets focus on the widget.

Type:

String

Default Value: null

The value of this option will be passed to the accesskey attribute of the HTML element that underlies the widget.

activeStateEnabled

Specifies whether or not the widget changes its state when interacting with a user.

Type:

Boolean

Default Value: false

This option is used when the widget is displayed on a platform whose guidelines include the active state change for widgets.

allowedFileExtensions

Specifies the allowed upload file extensions.

Type:

Array<String>

Default Value: []

View Demo

The FileManager widget cannot upload a file and displays an error message when the file's extension is not allowed.

DevExtreme File Manager - Allowed File Extension

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        allowedFileExtensions: [".js", ".json", ".css"]
        // ...
    });
});

contextMenu

Configures the context menu settings.

Type: dxFileManagerContextMenu

currentPath

Specifies the path that is used when the FileManager is initialized.

Type:

String

Default Value: ''

View Demo

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        currentPath: "Documents/Images"
        // ...
    });
});

currentPathKeys

Specifies an array of path keys to the current location.

Type:

Array<String>

Default Value: []

Each path part has each own key. For example, path "folder1/folder2" has two parts: 'folder1' with the 'f1' key and folder2 with the 'f2' key. To open this location, assign the ["f1","f2"] array of strings to the currentPathKeys option value.

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        currentPathKeys: ["EB458000-0341-6943", "92F5-4722-A7D6-98EB"]
        // ...
    });
});

customizeDetailColumns

Customizes columns in details view. Applies only if itemView.mode is "details".

Type:

Function

Function parameters:
columns:

Array<dxFileManagerDetailsColumn>

The columns before customization.

Return Value:

Array<dxFileManagerDetailsColumn>

The columns after customization.

jQuery
index.js
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        customizeDetailColumns: function(columns) {
            // ...
            // Customize the "columns" array objects here
            // ...
            return columns;
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-file-manager ...
    [customizeDetailColumns]="fileManager_customizeDetailColumns">
</dx-file-manager>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // Uncomment the following lines if the function should be executed in the component's context
    // constructor() {
    //     this.fileManager_customizeDetailColumns = this.fileManager_customizeDetailColumns.bind(this);
    // }

    fileManager_customizeDetailColumns(columns) {
        // ...
        // Customize the "columns" array objects here
        // ...
        return columns;
    }
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxFileManagerModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxFileManagerModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxFileManager ...
        :customize-detail-columns="fileManager_customizeDetailColumns"
    />
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DxFileManager from 'devextreme-vue/file-manager';

export default {
    components: {
        DxFileManager
    },
    methods: {
        fileManager_customizeDetailColumns(columns) {
            // ...
            // Customize the "columns" array objects here
            // ...
            return columns;
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import FileManager from 'devextreme-react/file-manager';

class App extends React.Component {
    // Uncomment the following lines if the function should be executed in the component's context
    // constructor(props) {
    //     super(props);
    //     this.fileManager_customizeDetailColumns = this.fileManager_customizeDetailColumns.bind(this);
    // }

    fileManager_customizeDetailColumns(columns) {
        // ...
        // Customize the "columns" array objects here
        // ...
        return columns;
    }

    render() {
        return (
            <FileManager ...
                customizeDetailColumns={this.fileManager_customizeDetailColumns}
            />
        );
    }
}
export default App;

customizeThumbnail

Allows you to provide custom icons to be used as thumbnails.

Type:

Function

Function parameters:
fileSystemItem: FileSystemItem

The file or folder whose thumbnail is being customized.

Return Value:

String

An icon to use as a thumbnail.

This function should return one of the following:

View Demo

disabled

Specifies whether the widget responds to user interaction.

Type:

Boolean

Default Value: false

elementAttr

Specifies the attributes to be attached to the widget's root element.

Type:

Object

Default Value: {}

jQuery
$(function(){
    $("#fileManagerContainer").dxFileManager({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-file-manager ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-file-manager>
import { DxFileManagerModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxFileManagerModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxFileManager ...
        :element-attr="fileManagerAttributes">
    </DxFileManager>
</template>

<script>
import DxFileManager from 'devextreme-vue/file-manager';

export default {
    components: {
        DxFileManager
    },
    data() {
        return {
            fileManagerAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import FileManager from 'devextreme-react/file-manager';

class App extends React.Component {
    fileManagerAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <FileManager ...
                elementAttr={this.fileManagerAttributes}>
            </FileManager>
        );
    }
}
export default App;
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().FileManager()
    .ElementAttr("class", "class-name")
    // ===== or =====
    .ElementAttr(new {
        @id = "elementId",
        @class = "class-name"
    })
    // ===== or =====
    .ElementAttr(new Dictionary<string, object>() {
        { "id", "elementId" },
        { "class", "class-name" }
    })

)
@(Html.DevExtreme().FileManager() _
    .ElementAttr("class", "class-name")
    ' ===== or =====
    .ElementAttr(New With {
        .id = "elementId",
        .class = "class-name"
    })
    ' ===== or =====
    .ElementAttr(New Dictionary(Of String, Object) From {
        { "id", "elementId" },
        { "class", "class-name" }
    })
)

fileSystemProvider

Specifies the file system provider.

Type:

Object

Default Value: null

File system providers are components that provide APIs used to access and modify virtual file systems.

The following example illustrates how to configure an Object file system provider:

jQuery
index.js
data.js
$(function () {
    $("#file-manager").dxFileManager({
        fileSystemProvider: fileSystem,
        // ...
    });
});
var fileSystem = [
    {
        name: "Documents",
        isDirectory: true,
        items: [
            {
                name: "Projects",
                isDirectory: true,
                items: [
                    {
                        name: "About.rtf",
                        isDirectory: false,
                        size: 1024
                    },
                    {
                        name: "Passwords.rtf",
                        isDirectory: false,
                        size: 2048
                    }
                ]
            },
            {
                name: "About.xml",
                isDirectory: false,
                size: 1024
            },
            //...
        ],
    },
    {
        name: "Images",
        isDirectory: true,
        items: [
            {
                name: "logo.png",
                isDirectory: false,
                size: 20480
            },
            {
                name: "banner.gif",
                isDirectory: false,
                size: 10240
            }
        ]
    },
    //...
];

Refer to File System Providers for information on supported file system providers.

focusedItemKey

Specifies a key of the initially or currently focused item.

Type:

String

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        focusedItemKey: "item1_key"
    });
});

focusStateEnabled

Specifies whether the widget can be focused using keyboard navigation.

Type:

Boolean

Default Value: false

height

Specifies the widget's height.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The widget's height.

Default Value: undefined

This option accepts a value of one of the following types:

  • Number
    The height in pixels.

  • String
    A CSS-accepted measurement of height. For example, "55px", "80%", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    height: function() {
        return window.innerHeight / 1.5;
    }

hint

Specifies text for a hint that appears when a user pauses on the widget.

Type:

String

Default Value: undefined

hoverStateEnabled

Specifies whether the widget changes its state when a user pauses on it.

Type:

Boolean

Default Value: false

itemView

Configures the file and folder view.

Type:

Object

Default Value: null

NOTE
Set the itemView.mode option to details to configure columns in the widget.

View Demo

DevExtreme File Manager - Item View

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        itemView: {
            mode: "details",
            showFolders: false,
            showParentFolder: false
        }
        // ...
    });
});

onContentReady

A function that is executed when the widget's content is ready and each time the content is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

Model data. Available only when using Knockout.

Default Value: null

onContextMenuItemClick

A function that is executed when a context menu item is clicked.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

event

Event (jQuery or dxEvent)

The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery.

itemData

Object

The clicked item's data.

itemElement

HTMLElement or jQuery

The item's container. It is an HTML Element or a jQuery Element when you use jQuery.

itemIndex

Number

The clicked item's index.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onContextMenuItemClick: function(e) {
            // Your code goes here
        }
    });
});

onCurrentDirectoryChanged

A function that is executed when the current directory is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

directory FileSystemItem

The current directory.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

The model data. Available only if you use Knockout.

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onCurrentDirectoryChanged: function(e) {
            // Your code goes here
        }
    });
});

onDisposing

A function that is executed before the widget is disposed of.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

onErrorOccurred

A function that is executed when an error occurs.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

errorCode

Number

The error code. The following error codes are supported:

  • NoAccess = 0

  • FileExists = 1

  • FileNotFound = 2

  • DirectoryExists = 3

  • DirectoryNotFound = 4

  • WrongFileExtension = 5

  • MaxFileSizeExceeded = 6

  • Other = 32767

errorText

String

The error message.

fileSystemItem FileSystemItem

The processed file or directory.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onErrorOccurred: function(e) {
            // Your code goes here
        }
    });
});

onFocusedItemChanged

A function that is executed when the focused item is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

item FileSystemItem

The currently focused file or directory.

itemElement

HTMLElement or jQuery

The item's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

The model data. Available only if you use Knockout.

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onFocusedItemChanged: function(e) {
            // Your code goes here
        }
    });
});

onInitialized

A function used in JavaScript frameworks to save the widget instance.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

Default Value: null

See Also

onOptionChanged

A function that is executed after a widget option is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

fullName

String

The path to the modified option that includes all parent options.

name

String

The modified option if it belongs to the first level. Otherwise, the first-level option it is nested into.

value any

The modified option's new value.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

onSelectedFileOpened

A function that is executed when the selected file is opened.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

file FileSystemItem

The opened file.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

jQuery
index.js
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onSelectedFileOpened: function(e) {
            // Your code goes here
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-file-manager ...
    (onSelectedFileOpened)="fileManager_onSelectedFileOpened($event)">
</dx-file-manager>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    fileManager_onSelectedFileOpened(e) {
        // Your code goes here
    }
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxFileManagerModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxFileManagerModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxFileManager ...
        :selected-file-opened="fileManager_onSelectedFileOpened"
    />
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DxFileManager from 'devextreme-vue/file-manager';

export default {
    components: {
        DxFileManager
    },
    methods: {
        fileManager_onSelectedFileOpened(e) {
            // Your code goes here
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import FileManager from 'devextreme-react/file-manager';

class App extends React.Component {
    fileManager_onSelectedFileOpened(e) {
        // Your code goes here
    }

    render() {
        return (
            <FileManager ...
                onSelectedFileOpened={this.fileManager_onSelectedFileOpened}
            />
        );
    }
}
export default App;

onSelectionChanged

A function that is executed when a file system item is selected or selection is canceled.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

currentDeselectedItemKeys

Array<String>

The keys of the file system items whose selection has been cleared.

currentSelectedItemKeys

Array<String>

The keys of the file system items that have been selected.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

Model data. Available only if you use Knockout.

selectedItemKeys

Array<String>

The keys of all selected file system items.

selectedItems

Array<FileSystemItem>

The currently selected file system items.

Default Value: null

jQuery
index.js
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onSelectionChanged: function(e) {
            // Your code goes here
        }
    });
});

onToolbarItemClick

A function that is executed when a toolbar item is clicked.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

FileManager

The widget's instance.

element

HTMLElement or jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

event

Event (jQuery or dxEvent)

The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery.

itemData

Object

The clicked item's data.

itemElement

HTMLElement or jQuery

The item's container. It is an HTML Element or a jQuery Element when you use jQuery.

itemIndex

Number

The clicked item's index.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        onToolbarItemClick: function(e) {
            // Your code goes here
        }
    });
});

permissions

Specifies actions that a user is allowed to perform on files and folders.

Type:

Object

View Demo

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        permissions: {
            create: true,
            copy: true,
            move: true,
            remove: true,
            rename: true
        },
        // ...
    });
});

rootFolderName

Specifies the root folder name.

Type:

String

Default Value: 'Files'

jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        rootFolderName: "~/Files"
        // ...
    });
});

rtlEnabled

Switches the widget to a right-to-left representation.

Type:

Boolean

Default Value: false

When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});
See Also

selectedItemKeys

Contains an array of initially or currently selected files and directories' keys.

Type:

Array<String>

Default Value: []

jQuery
JavaScript
$(function() {
    $("#fileManagerContainer").dxFileManager({
        // ...
        selectedItemKeys: ["item1_key", "item2_key", "item3_key"]
    });
});

selectionMode

Specifies whether a user can select a single or multiple files and folders in the item view simultaneously.

Type:

String

Default Value: 'multiple'
Accepted Values: 'multiple' | 'single'

NOTE
The check boxes that select/unselect individual items are displayed only in multiple selection mode.
jQuery
JavaScript
$(function () {
    $("#file-manager").dxFileManager({
        selectionMode: "single"
        // ...
    });
});    

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

Type:

Number

Default Value: 0

The value of this option will be passed to the tabindex attribute of the HTML element that underlies the widget.

toolbar

Configures toolbar settings.

Type: dxFileManagerToolbar

upload

Configures upload settings.

Type:

Object

visible

Specifies whether the widget is visible.

Type:

Boolean

Default Value: true

width

Specifies the widget's width.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The widget's width.

Default Value: undefined

This option accepts a value of one of the following types:

  • Number
    The width in pixels.

  • String
    A CSS-accepted measurement of width. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    width: function() {
        return window.innerWidth / 1.5;
    }