Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

排序问题 #2

Closed
he-sb opened this issue May 20, 2020 · 4 comments
Closed

排序问题 #2

he-sb opened this issue May 20, 2020 · 4 comments

Comments

@he-sb
Copy link

he-sb commented May 20, 2020

只有选择“文件夹优先”时才能使文件夹优先显示,其他排序方式都是文件和文件夹混着的,不太方便查看;

而使用文件夹优先的话,就没办法在此基础上按照文件名或修改时间来排序了。

@rixtox
Copy link

rixtox commented May 20, 2020

從 API 的層面上是可以做到多級排序的,問題還是在於 UI 上。比如這種 UI 就非常複雜了

在前端畫這種複雜的 UI 對我來説太難了,而且還要考慮移動端適配問題的話就更複雜了。如果有大佬幫忙畫的話我倒是很樂意實現相應功能。

目前來説可能對你最有意義的是直接加入你自己想要的排序方式:

gdir/app/FileList.tsx

Lines 97 to 98 in 70d6926

ascendingQuery: 'folder,name,modifiedTime desc',
descendingQuery: 'folder desc,name,modifiedTime desc',

@he-sb
Copy link
Author

he-sb commented May 20, 2020

其实主要的需求是在现有的排序功能基础上,能够默认使文件夹优先显示就好了,现在默认是文件和文件夹混排的,不太符合大多数本地文件管理器的使用习惯 🙈

@rixtox
Copy link

rixtox commented May 20, 2020

這可不一定,我個人的習慣就不是文件夾優先的,而是更改時間優先,或者文件名優先。如果使用任何假設的習慣來設計,可能以後會有別人開個 issue 說自己有不一樣的習慣,這樣很難處理的。

所以我覺得如果有特殊的多級排序需求,自己在代碼中添加一個排序選項就是了,複製粘貼的事情,並不難改。比如你想要按 文件夾-時間 的層級排序,可以添加這樣的排序選項:

    folder_modifiedTime: {
        name: 'Folders - Modified Time',
        field: 'folder_modifiedTime',
        defaultDescending: false,
        ascendingIcon: 'fa-sort-down',
        descendingIcon: 'fa-sort-sort-up',
        ascendingQuery: 'folder,modifiedTime',
        descendingQuery: 'folder,modifiedTime desc',
    },

@he-sb
Copy link
Author

he-sb commented May 20, 2020

這可不一定,我個人的習慣就不是文件夾優先的,而是更改時間優先,或者文件名優先。如果使用任何假設的習慣來設計,可能以後會有別人開個 issue 說自己有不一樣的習慣,這樣很難處理的。

所以我覺得如果有特殊的多級排序需求,自己在代碼中添加一個排序選項就是了,複製粘貼的事情,並不難改。比如你想要按 文件夾-時間 的層級排序,可以添加這樣的排序選項:

    folder_modifiedTime: {
        name: 'Folders - Modified Time',
        field: 'folder_modifiedTime',
        defaultDescending: false,
        ascendingIcon: 'fa-sort-down',
        descendingIcon: 'fa-sort-sort-up',
        ascendingQuery: 'folder,modifiedTime',
        descendingQuery: 'folder,modifiedTime desc',
    },

okk,因为个人接触过的比如 Windows 的资源管理器和 Manjaro KDE 自带的 Dolphin 默认排序都是文件夹在前的,乍一看混排的有点不习惯,感谢作者提醒。

@rixtox rixtox closed this as completed May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants