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)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
groupKey, _ := attrView.GetKey(group.Field)
|
groupKey := view.GetGroupKey(attrView)
|
||||||
if nil == groupKey {
|
if nil == groupKey {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1611,9 +1611,19 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
return items[i].GetValue(group.Field).Number.Content < items[j].GetValue(group.Field).Number.Content
|
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:
|
case av.GroupMethodDateDay, av.GroupMethodDateWeek, av.GroupMethodDateMonth, av.GroupMethodDateYear, av.GroupMethodDateRelative:
|
||||||
sort.SliceStable(items, func(i, j int) bool {
|
if av.KeyTypeCreated == groupKey.Type {
|
||||||
return items[i].GetValue(group.Field).Date.Content < items[j].GetValue(group.Field).Date.Content
|
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
|
var groupName string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue