Angular FileManager Properties
This section describes properties that configure the FileManager UI component's contents, behavior, and appearance.
accessKey
The value of this property will be passed to the accesskey
attribute of the HTML element that underlies the UI component.
allowedFileExtensions
The FileManager UI component cannot upload a file and displays an error message when the file's extension is not allowed.
- <dx-file-manager id="fileManager"
- [allowedFileExtensions]="['.js', '.json', '.css']">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
currentPath
- <dx-file-manager id="fileManager"
- [currentPath]="Documents/Images">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
currentPathKeys
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 property value.
- <dx-file-manager id="fileManager"
- [currentPathKeys]="['EB458000-0341-6943', '92F5-4722-A7D6-98EB']">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
customizeDetailColumns
Customizes columns in details view. Applies only if itemView.mode is "details".
- <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 { }
customizeThumbnail
This function should return one of the following:
- The icon's URL
- The icon's name if the icon is from the DevExtreme icon library
- The icon's CSS class if the icon is from an external icon library (see External Icon Libraries)
- The icon in the Base64 format
elementAttr
Specifies the global attributes to be attached to the UI component's container element.
fileSystemProvider
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:
- <dx-file-manager id="fileManager"
- [fileSystemProvider]="fileSystem">
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- 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
- }]
- }];
- }
- 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
- ],
- //...
- })
- export class AppModule { }
Refer to File System Providers for information on supported file system providers.
focusedItemKey
- <dx-file-manager id="fileManager"
- [focusedItemKey]="item1_key">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
height
This property 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;
- }
itemView
- <dx-file-manager>
- <dxo-item-view
- mode="thumbnails"
- showFolders="false"
- showParentFolder="false" >
- </dxo-item-view>
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
onContentReady
A function that is executed when the UI component's content is ready and each time the content is changed.
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
Model data. Available only when using Knockout. |
onContextMenuItemClick
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
event | Event (jQuery or EventObject) |
The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery. |
fileSystemItem |
The file system item for which you invoke the context menu. |
|
itemData |
The clicked item's data. |
|
itemElement |
The item's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
itemIndex |
The clicked item's index. |
|
model |
Model data. Available only if you use Knockout. |
|
viewArea | 'navPane' | 'itemView' |
Specifies whether the context menu is invoked in the navigation panel or in the items area. |
- <dx-file-manager
- (onContextMenuItemClick)="onItemClick($event)">
- <dxo-context-menu>
- <dxi-item text="Create .txt Document" [options]="{ extension: '.txt' }"></dxi-item>
- <dxi-item text="Create .rtf Document" [options]="{ extension: '.rtf' }"></dxi-item>
- <dxi-item text="Create .xls Document" [options]="{ extension: '.xls' }"></dxi-item>
- </dxo-context-menu>
- <!-- ... -->
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- onItemClick(e){
- if(e.itemData.options.extension) {
- // your code
- }
- }
- }
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { AppComponent } from './app.component';
- import { DxFileManagerModule } from 'devextreme-angular';
- @NgModule({
- imports: [
- DxFileManagerModule
- ],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
onCurrentDirectoryChanged
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
directory |
The current directory. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
- <dx-file-manager
- (onCurrentDirectoryChanged)="onDirectoryChanged($event)">
- <!-- ... -->
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- onDirectoryChanged(e){
- // your code
- }
- }
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { AppComponent } from './app.component';
- import { DxFileManagerModule } from 'devextreme-angular';
- @NgModule({
- imports: [
- DxFileManagerModule
- ],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
onDisposing
A function that is executed before the UI component is disposed of.
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
Model data. Available only if you use Knockout. |
onErrorOccurred
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
errorCode |
The error code. The following error codes are supported:
|
|
errorText |
The error message. |
|
fileSystemItem |
The processed file or directory. |
|
model |
Model data. Available only if you use Knockout. |
- <dx-file-manager
- (onErrorOccurred)="onError($event)">
- <!-- ... -->
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- onOccurred(e){
- // your code
- }
- }
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { AppComponent } from './app.component';
- import { DxFileManagerModule } from 'devextreme-angular';
- @NgModule({
- imports: [
- DxFileManagerModule
- ],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
onFocusedItemChanged
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
item |
The currently focused file or directory. |
|
itemElement |
The item's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
- <dx-file-manager
- (onFocusedItemChanged)="onFocusedItemChangedEv($event)">
- <!-- ... -->
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- onFocusedItemChangedEv(e){
- // your code
- }
- }
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { AppComponent } from './app.component';
- import { DxFileManagerModule } from 'devextreme-angular';
- @NgModule({
- imports: [
- DxFileManagerModule
- ],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
onInitialized
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
onOptionChanged
Name | Type | Description |
---|---|---|
model |
Model data. Available only if you use Knockout. |
|
fullName |
The path to the modified property that includes all parent properties. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
|
name |
The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into. |
|
value | any |
The modified property's new value. |
The following example shows how to subscribe to component property changes:
- <dx-file-manager ...
- (onOptionChanged)="handlePropertyChange($event)">
- </dx-file-manager>
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- // ...
- handlePropertyChange(e) {
- if(e.name === "changedProperty") {
- // handle the property change 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 { }
onSelectedFileOpened
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
file |
The opened file. |
|
model |
Model data. Available only if you use Knockout. |
- <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 { }
onSelectionChanged
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
currentDeselectedItemKeys |
The keys of the file system items whose selection has been cleared. |
|
currentSelectedItemKeys |
The keys of the file system items that have been selected. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
Model data. Available only if you use Knockout. |
|
selectedItemKeys |
The keys of all selected file system items. |
|
selectedItems |
The currently selected file system items. |
- <dx-file-manager ...
- (onSelectionChanged)="fileManager_onSelectionChanged($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_onSelectionChanged(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 { }
onToolbarItemClick
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
event | Event (jQuery or EventObject) |
The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery. |
itemData |
The clicked item's data. |
|
itemElement |
The item's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
itemIndex |
The clicked item's index. |
|
model |
Model data. Available only if you use Knockout. |
- <dx-file-manager ...
- (onToolbarItemClick)="fileManager_onToolbarItemClick($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_onToolbarItemClick(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 { }
permissions
- <dx-file-manager id="fileManager">
- <dxo-permissions
- create="true"
- copy="true"
- move="true"
- delete="true"
- rename="true"
- upload="true"
- download="true">
- </dxo-permissions>
- <!-- ... -->
- </dx-file-manager>
- import { DxFileManagerModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxFileManagerModule
- ],
- // ...
- })
rootFolderName
- <dx-file-manager id="fileManager"
- [rootFolderName]="~/Files">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
rtlEnabled
When this property is set to true, the UI component 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.
- DevExpress.config({
- rtlEnabled: true
- });
selectedItemKeys
- <dx-file-manager id="fileManager"
- [selectedItemKeys]="['item1_key', 'item2_key', 'item3_key']">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
selectionMode
Specifies whether a user can select a single or multiple files and folders in the item view simultaneously.
- <dx-file-manager id="fileManager"
- [selectionMode]="single">
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
tabIndex
The value of this property will be passed to the tabindex
attribute of the HTML element that underlies the UI component.
toolbar
The FileManager UI component allows you to add default and custom toolbar items.
Predefined Items
Predefined toolbar items include:
- 'showNavPane' - Shows or hides the navigation panel.
- 'create' - Creates a new directory.
- 'upload' - Uploads a file.
- 'refresh' - Refreshes the file manager content and shows the progress panel.
- 'download' - Downloads a file.
- 'move' - Moves files and directories.
- 'copy' - Copies files and directories.
- 'rename' - Renames files and directories.
- 'delete' - Deletes files and directories.
- 'switchView' - Switches between the 'Details' and 'Thumbnails' file system representation modes.
- 'clearSelection' - Clears selection from files and directories in the Item View area.
To add a predefined item to the toolbar, specify its name and optional settings ('visible', 'location', 'locateInMenu', 'text', 'icon', 'disabled') and add the item to one of the following collections:
items - Displays toolbar items when no file system item is selected.
fileSelectionItems - Displays toolbar items when one or more file system items are selected.
- <dx-file-manager>
- <dxo-toolbar>
- <!-- Specifies a predefined item's name and optional settings -->
- <dxi-item name="create" text="Create a directory" icon="newfolder"></dxi-item>
- <!-- Specifies a predefined item's name only -->
- <dxi-item name="switchView"></dxi-item>
- <dxi-item name="separator"></dxi-item>
- <!-- Specifies items that are visible when users select files -->
- <dxi-file-selection-item name="copy"></dxi-file-selection-item>
- <dxi-file-selection-item name="rename"></dxi-file-selection-item>
- </dxo-toolbar>
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
Custom Items
To add a custom toolbar item, specify its text and optional settings (for example, a file extension for the toolbar item that creates a new file) and add the item to one of the following collections:
items - Displays toolbar items when no file system item is selected.
fileSelectionItems - Displays toolbar items when one or more file system items are selected.
The widget property allows you to specify a UI component for a custom toolbar item (dxButton is the default UI component). Use the toolbarItemClick event to handle clicks on custom toolbar items.
- <dx-file-manager>
- <dxo-toolbar>
- <dxi-item widget="dxMenu" [options]="fileMenuOptions"></dxi-item>
- </dxo-toolbar>
- </dx-file-manager>
- import { Component } from '@angular/core';
- import { Service } from './app.service';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css'],
- providers: [Service]
- })
- export class AppComponent {
- constructor(service: Service) {
- this.fileMenuOptions = {
- items: [
- {
- text: "Create new file",
- icon: "plus",
- items: [
- {
- text: "Text Document",
- options: {
- extension: ".txt",
- }
- },
- {
- text: "RTF Document",
- options: {
- extension: ".rtf",
- }
- },
- {
- text: "Spreadsheet",
- options: {
- extension: ".xls",
- }
- }
- ]
- }
- ],
- onItemClick: () => {
- // ...
- }
- };
- }
- }
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { AppComponent } from './app.component';
- import { DxFileManagerModule } from 'devextreme-angular';
- @NgModule({
- imports: [
- BrowserModule,
- DxFileManagerModule
- ],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
upload
- <dx-file-manager id="fileManager">
- <dxo-upload [chunkSize]="500000" [maxFileSize]="1000000" ></dxo-upload>
- <!-- ... -->
- </dx-file-manager>
- 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
- ],
- //...
- })
- export class AppModule { }
width
This property 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;
- }
If you have technical questions, please create a support ticket in the DevExpress Support Center.