Unplanned
Last Updated: 25 Apr 2025 12:31 by David

I want to use the built-in FileManagerToolBarSortTool but I want to remove the "Date Modified" option from the "Sort BY" menu.

===

ADMIN EDIT

===

For the time being, a possible option is to create a custom tool for sorting. You can use the SplitButton component to simulate the built-in UI. Upon selecting option from the dropdown, you may sort your data collection based on the selected custom sort option. Call the Rebind method to refresh the data after updating it.

Duplicated
Last Updated: 13 May 2025 07:47 by ADMIN
Created by: Harald
Comments: 0
Category: FileManager
Type: Feature Request
1
While many properties of the `TelerikUpload` component inside the `TelerikFileManager` are customizable using the `FileManagerUploadSettings` some aren't.

The `Multiple` property is always set to `false` (see code below); one can drag & drop multiple files to the dropzone but only one is uploaded at a time.
Our customers won't accept this behavior as it makes uploads of multiple files very cumbersome. This "detail" makes the `TelerikFileManager` unsuitable for our application.

Please make the `Multiple` property configurable via the `FileManagerUploadSettings`.
(You may also want to consider making `AutoUpload` configurable while you're at it).
__builder2.OpenComponent<TelerikUpload>(266);
__builder2.AddAttribute(267, "AutoUpload", (object?)RuntimeHelpers.TypeCheck(value: true));
__builder2.AddAttribute(268, "SaveUrl", (object?)RuntimeHelpers.TypeCheck(UploadSettings.SaveUrl));
__builder2.AddAttribute(269, "SaveField", (object?)RuntimeHelpers.TypeCheck(UploadSettings.SaveField));
__builder2.AddAttribute(270, "RemoveUrl", (object?)RuntimeHelpers.TypeCheck(UploadSettings.RemoveUrl));
__builder2.AddAttribute(271, "RemoveField", (object?)RuntimeHelpers.TypeCheck(UploadSettings.RemoveField));
__builder2.AddAttribute(272, "WithCredentials", (object?)RuntimeHelpers.TypeCheck(UploadSettings.WithCredentials));
__builder2.AddAttribute(273, "Multiple", (object?)RuntimeHelpers.TypeCheck(value: false));
__builder2.AddAttribute(274, "AllowedExtensions", RuntimeHelpers.TypeCheck(UploadSettings.AllowedExtensions));
__builder2.AddAttribute(275, "MinFileSize", RuntimeHelpers.TypeCheck(UploadSettings.MinFileSize));


Unplanned
Last Updated: 05 Nov 2025 09:20 by Victoria

The FileManager TreeView does not expand automatically in some scenarios, which can cause the TreeView and ListView UI to be inconsistent:

  • Programmatic Path change.
  • When clicking on a folder in the TreeView.
  • When navigating to a folder from the ListView, while its parent is not already expanded.

Here is a test page and steps to reproduce.

Test 1

  1. Copy `/folder-16/folder-17` in the textbox and hit Enter.
  2. The FileManager navigates to the specified folder and the TreeView selects it, but does not expand.

Test 2

  1. Click on `folder-16` in the TreeView.
  2. The TreeView does not expand, but it should.
  3. Double-click `folder-17` in the ListView.
  4. The FileManager navigates and the TreeView selects the new folder, but does not expand.

<p>/folder-16/folder-17</p>

<TelerikTextBox @bind-Value="@DirectoryPath" Width="max-content" OnChange="@(() => FileManagerRef!.Rebind())" />

<TelerikFileManager @ref="@FileManagerRef"
                    Data="@FileManagerData"
                    @bind-Path="@DirectoryPath"
                    View="@FileManagerViewType.ListView"
                    EnableLoaderContainer="false"
                    OnDownload="@OnDownloadHandler"
                    NameField="@(nameof(FlatFileEntry.Name))"
                    SizeField="@(nameof(FlatFileEntry.Size))"
                    PathField="@(nameof(FlatFileEntry.Path))"
                    ExtensionField="@(nameof(FlatFileEntry.Extension))"
                    IsDirectoryField="@(nameof(FlatFileEntry.IsDirectory))"
                    HasDirectoriesField="@(nameof(FlatFileEntry.HasDirectories))"
                    IdField="@(nameof(FlatFileEntry.Id))"
                    ParentIdField="@(nameof(FlatFileEntry.ParentId))"
                    DateCreatedField="@(nameof(FlatFileEntry.DateCreated))"
                    DateCreatedUtcField="@(nameof(FlatFileEntry.DateCreatedUtc))"
                    DateModifiedField="@(nameof(FlatFileEntry.DateModified))"
                    DateModifiedUtcField="@(nameof(FlatFileEntry.DateModifiedUtc))"
                    Class="my-filemanager">
</TelerikFileManager>

@code {
    private TelerikFileManager<FlatFileEntry>? FileManagerRef { get; set; }

    private List<FlatFileEntry>? FileManagerData { get; set; }

    public string? DirectoryPath { get; set; } = string.Empty;

    private readonly string RootPath = string.Empty;

    public async Task<bool> OnDownloadHandler(FileManagerDownloadEventArgs args)
    {
        await Task.Delay(1);

        return true;
    }

    private int FolderLevelCount { get; set; } = 5;
    private int FilesInFolderCount { get; set; } = 5;
    private int FoldersInFolderCount { get; set; } = 2;
    private int FolderNameCounter { get; set; }
    private readonly List<string> FileExtensions = new() {
            ".txt", ".pdf", ".docx", ".xlsx", ".png", ".jpg", ".gif", ".zip", ".css", ".html", ".mp3", ".mpg"
        };

    protected override async Task OnInitializedAsync()
    {
        await Task.CompletedTask;

        DirectoryPath = RootPath;

        FileManagerData = LoadFlatDataAsync();

        await base.OnInitializedAsync();
    }

    private List<FlatFileEntry> LoadFlatDataAsync()
    {
        List<FlatFileEntry> data = new List<FlatFileEntry>();

        string rootDataPath = string.IsNullOrEmpty(RootPath) ? "/" : RootPath;

        PopulateChildren(data, null, rootDataPath, 1);

        return data;
    }

    private void PopulateChildren(List<FlatFileEntry> data, string? parentId, string parentPath, int level)
    {
        var rnd = Random.Shared;

        for (int i = 1; i <= FilesInFolderCount; i++)
        {
            string itemId = Guid.NewGuid().ToString();
            string itemExtension = FileExtensions[rnd.Next(0, FileExtensions.Count)];
            string itemName = $"{itemExtension.Substring(1)}-file-{(FolderNameCounter != default ? string.Concat(FolderNameCounter, "-") : string.Empty)}{i}";
            string itemPath = Path.Combine(parentPath, string.Concat(itemName, itemExtension));

            data.Add(new FlatFileEntry()
            {
                Id = itemId,
                ParentId = parentId,
                Name = itemName,
                IsDirectory = false,
                HasDirectories = false,
                DateCreated = DateTime.Now,
                DateCreatedUtc = DateTime.Now.ToUniversalTime(),
                DateModified = DateTime.Now,
                DateModifiedUtc = DateTime.Now.ToUniversalTime(),
                Path = itemPath,
                Extension = itemExtension,
                Size = rnd.Next(1_000, 3_000_000)
            });
        }

        if (level < FolderLevelCount)
        {
            for (int i = 1; i <= FoldersInFolderCount; i++)
            {
                var itemId = Guid.NewGuid().ToString();
                var itemName = $"folder-{++FolderNameCounter}";
                var itemPath = Path.Combine(parentPath, itemName);

                data.Add(new FlatFileEntry()
                {
                    Id = itemId,
                    ParentId = parentId,
                    Name = itemName,
                    IsDirectory = true,
                    HasDirectories = level < FolderLevelCount - 1,
                    DateCreated = DateTime.Now,
                    DateCreatedUtc = DateTime.Now.ToUniversalTime(),
                    DateModified = DateTime.Now,
                    DateModifiedUtc = DateTime.Now.ToUniversalTime(),
                    Path = itemPath,
                    Size = rnd.Next(100_000, 10_000_000)
                });

                PopulateChildren(data, itemId, itemPath, level + 1);
            }
        }
    }

    public class FlatFileEntry : FileEntry
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();

        public string ParentId { get; set; }
    }

    public class FileEntry
    {
        public string Name { get; set; }

        public long Size { get; set; }

        public string Path { get; set; }

        public string Extension { get; set; }

        public bool IsDirectory { get; set; }

        public bool HasDirectories { get; set; }

        public DateTime DateCreated { get; set; }

        public DateTime DateCreatedUtc { get; set; }

        public DateTime DateModified { get; set; }

        public DateTime DateModifiedUtc { get; set; }
    }
}

1 2 3