# file-manager-custom-sorting

> File manager that applies a natural sort comparer so numbered folders sort in numeric order.

**Framework:** react  **Component:** FileManager  **Variant:** custom-sorting

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/ts/file-manager-custom-sorting.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-filemanager
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/file-manager-custom-sorting/FileManager.tsx

```tsx
import { DetailsView, FileManagerComponent, NavigationPane, Toolbar, Inject, sortComparer, type SortComparer } from '@syncfusion/ej2-react-filemanager';

/**
 * File Manager custom sorting sample
 */
const CustomSorting = () => {
  let hostUrl : string = "https://physical-service.syncfusion.com/";
  let ajaxSettings: object = {
    downloadUrl: hostUrl + 'api/NaturalSorting/Download',
    getImageUrl: hostUrl + "api/NaturalSorting/GetImage",
    uploadUrl: hostUrl + 'api/NaturalSorting/Upload',
    url: hostUrl + "api/NaturalSorting/FileOperations"
  };
  let detailsViewSettings: object = {
    columns: [
      { field: 'name', headerText: 'File Name', minWidth: 120, width: 'auto', sortComparer: sortComparer },
      { field: 'size', headerText: 'File Size', minWidth: 50, width: '110', template: '${size}' },
      { field: '_fm_modified', headerText: 'Date Modified', minWidth: 50, width: '190' }
    ]
  };
  let height: string = "375px";

  return (<div className="control-section">
    <FileManagerComponent id="file" height={height} ajaxSettings={ajaxSettings} detailsViewSettings={detailsViewSettings} sortComparer={sortComparer as SortComparer}>
      <Inject services={[NavigationPane, DetailsView, Toolbar]} />
    </FileManagerComponent>
  </div>);
}
export default CustomSorting;

```
