From b15489a4cf237a42e65758c19f59698618512720 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 25 Jul 2025 19:06:38 +0800 Subject: [PATCH] :art: Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964 --- kernel/model/attribute_view.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 22c9428ae..0616dba48 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1662,6 +1662,15 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) { } } } + + if av.GroupOrderMan != view.Group.Order { + sort.SliceStable(view.Groups, func(i, j int) bool { + if av.GroupOrderAsc == view.Group.Order { + return view.Groups[i].Name < view.Groups[j].Name + } + return view.Groups[i].Name > view.Groups[j].Name + }) + } } func isGroupByDate(view *av.View) bool {