# file-manager-custom-sorting

> File manager that applies a natural sort comparer so numbered folders sort in numeric order.

**Framework:** angular  **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/angular/file-manager-custom-sorting.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-angular-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/file-manager.component.html

```html
<div class="sample-container">
    <ejs-filemanager id='overview' [ajaxSettings]='ajaxSettings' [sortComparer]='sortComparer' [detailsViewSettings]='detailsViewSettings' height="375px">
    </ejs-filemanager>
</div>

```

### src/components/file-manager-custom-sorting/file-manager.component.ts

```typescript
import { Component, ViewEncapsulation } from '@angular/core';
import { FileManagerModule, NavigationPaneService, ToolbarService, DetailsViewService, sortComparer } from '@syncfusion/ej2-angular-filemanager';
/**
 * File Manager custom sorting sample
 */
@Component({
    selector: 'control-content',
    templateUrl: 'file-manager.component.html',
    styleUrls: ['../file-manager-common.style.css'],
    encapsulation: ViewEncapsulation.None,
    providers: [NavigationPaneService, ToolbarService, DetailsViewService],
    standalone: true,
    imports: [FileManagerModule]
})

export class CustomSortingController {
    public ajaxSettings?: object;
    public sortComparer?: object;
    public detailsViewSettings?: object;
    public hostUrl: string = 'https://physical-service.syncfusion.com/';
    public ngOnInit(): void {
        this.ajaxSettings = {
            url: this.hostUrl + 'api/NaturalSorting/FileOperations',
            getImageUrl: this.hostUrl + 'api/NaturalSorting/GetImage',
            uploadUrl: this.hostUrl + 'api/NaturalSorting/Upload',
            downloadUrl: this.hostUrl + 'api/NaturalSorting/Download'
        };
        this.sortComparer = sortComparer;
        this.detailsViewSettings = {
            columns: [
                { field: 'name', headerText: 'File Name', minWidth: 120, width: 'auto', customAttributes: { class: 'e-fe-grid-name' }, template: '${name}', sortComparer: sortComparer },
                { field: 'size', headerText: 'File Size', minWidth: 50, width: '110', template: '${size}' },
                { field: '_fm_modified', headerText: 'Date Modified', minWidth: 50, width: '190' }
            ]
        };
    }
}

```
