mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
05e495406d
commit
1812e84219
1 changed files with 14 additions and 4 deletions
|
@ -1588,7 +1588,7 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
|||
items = append(items, item)
|
||||
}
|
||||
|
||||
groupKey, _ := attrView.GetKey(group.Field)
|
||||
groupKey := view.GetGroupKey(attrView)
|
||||
if nil == groupKey {
|
||||
return
|
||||
}
|
||||
|
@ -1611,10 +1611,20 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
|||
return items[i].GetValue(group.Field).Number.Content < items[j].GetValue(group.Field).Number.Content
|
||||
})
|
||||
case av.GroupMethodDateDay, av.GroupMethodDateWeek, av.GroupMethodDateMonth, av.GroupMethodDateYear, av.GroupMethodDateRelative:
|
||||
if av.KeyTypeCreated == groupKey.Type {
|
||||
sort.SliceStable(items, func(i, j int) bool {
|
||||
return items[i].GetValue(group.Field).Created.Content < items[j].GetValue(group.Field).Created.Content
|
||||
})
|
||||
} else if av.KeyTypeUpdated == groupKey.Type {
|
||||
sort.SliceStable(items, func(i, j int) bool {
|
||||
return items[i].GetValue(group.Field).Updated.Content < items[j].GetValue(group.Field).Updated.Content
|
||||
})
|
||||
} else if av.KeyTypeDate == groupKey.Type {
|
||||
sort.SliceStable(items, func(i, j int) bool {
|
||||
return items[i].GetValue(group.Field).Date.Content < items[j].GetValue(group.Field).Date.Content
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var groupName string
|
||||
groupItemsMap := map[string][]av.Item{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue