Daniel 2025-07-02 17:02:40 +08:00
parent 45f10bf62a
commit eca87831fe
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
10 changed files with 99 additions and 190 deletions

View file

@ -619,16 +619,16 @@ func filterByQuery(query string, collection av.Collection) {
}
// manualSort 处理用户手动排序。
func manualSort(collectionLayout av.CollectionLayout, collection av.Collection) {
sortRowIDs := map[string]int{}
for i, itemID := range collectionLayout.GetItemIDs() {
sortRowIDs[itemID] = i
func manualSort(view *av.View, collection av.Collection) {
sortItemIDs := map[string]int{}
for i, itemID := range view.ItemIDs {
sortItemIDs[itemID] = i
}
items := collection.GetItems()
sort.Slice(items, func(i, j int) bool {
iv := sortRowIDs[items[i].GetID()]
jv := sortRowIDs[items[j].GetID()]
iv := sortItemIDs[items[i].GetID()]
jv := sortItemIDs[items[j].GetID()]
if iv == jv {
return items[i].GetID() < items[j].GetID()
}