Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Custom Filter API

  • Create (F7)Create
  • Rename (F2)Rename
  • Move (F6)Move
  • CopyCopy
  • Delete (Del)Delete
  • RefreshRefresh
  • DownloadDownload
  •  
    ...
 
 
Name 
Date modified 
Size 
Contracts
11/8/2018 4:15:00 AMFolder
Projects
11/8/2018 4:15:00 AMFolder
Reports
11/8/2018 4:15:00 AMFolder
Requests
11/8/2018 4:15:00 AMFolder
Account information.docx
11/7/2018 7:54:21 AM1 B
Bill payment.xlsx
11/7/2018 7:53:58 AM1 B
Design.rtf
11/7/2018 7:53:58 AM1 B
Packing list.xlsx
11/7/2018 7:53:58 AM1 B
Purchase invoice.docx
11/7/2018 7:54:21 AM1 B
Upload

Allowed Extensions: .jpg, .jpeg, .gif, .rtf, .txt, .png, .doc, .docx, .pdf, .xls, .xlsx



The DevExpress ASP.NET MVC File Manager provides APIs allowing you to filter its file list programmatically in a custom manner. For instance, you can write code to display only certain files types (such as images, spreadsheets or rich text documents) or the most recently used files.

To implement custom filters, you need to manually obtain the required files from your file system provider. Use the following APIs for this purpose.

  • The MVCxFileManager.FileListCustomFilter property.
    Specify the name of your custom filter to be currently applied to the File Manager's file list. Use this property to identify the active filter among all named custom filters you implement.
  • The MVCxFileManager.FileListCustomFilterBreadcrumbsText property.
    Optionally, specify the breadcrumbs text to be displayed in the File Manager for the applied filter.
  • The FileSystemProviderBase.GetFilteredItems method.
    Override this method within your file system provider to provide implementations of all custom filters to be used in the File Manager. This method has a parameter of the FileManagerGetFilteredItemsArgs type whose properties allow you to identify the filter, determine its additional characteristics and return file items matching the filter.
  • The FileManagerGetFilteredItemsArgs object's properties:

    • FileListCustomFilter - Gets the active filter's name (specified by the File Manager's FileListCustomFilter property).
    • FilterBoxText - Gets the search string entered into the File Manager's filter box.
    • Folder - Gets the File Manager's currently active folder.
    • Items - Specifies a collection of file items (FileManagerFile or FileManagerFolder instances) that match the applied filter.

This demo illustrates how to implement custom filters - in the demo they are 'Recent', 'RTF Docs', 'Sheets', 'Images', 'PDFs', and 'Favorites'. They allow end-users to filter the File Manager's file list by a certain criterion and to search within the applied filter using the filter box.

Note that in this demo, custom filters' UI is implemented using the Menu extension that is displayed instead of the File Manager's folder list view. Each menu item identifies the corresponding custom filter by its name. Clicks on menu items are processed on the client side to initiate the File Manager's custom callback passing the clicked item's name to the server (through the PerformCallback client-side method). On the server side, in the Controller action specified by the FileManagerSettings.CustomActionRouteValues property, this name (identifying the filter to apply) is passed to the File Manager's partial view through ViewData, and a collection of filtered items is passed to the partial view as a Model. Implementation of individual custom filters is given in the CustomFileSystemProvider class that inherits functionality from the standard PhysicalFileSystemProvider and overrides the FileSystemProviderBase.GetFilteredItems method.