mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
41087fd483
commit
d5731c9a3e
2 changed files with 5 additions and 5 deletions
|
|
@ -148,7 +148,7 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error
|
||||||
// TODO Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
|
// TODO Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
|
||||||
// 生成分组数据
|
// 生成分组数据
|
||||||
groupItems := map[string][]av.Item{}
|
groupItems := map[string][]av.Item{}
|
||||||
viewable := sql.RenderView(view, attrView, "")
|
viewable := sql.RenderView(attrView, view, "")
|
||||||
collection := viewable.(av.Collection)
|
collection := viewable.(av.Collection)
|
||||||
for _, item := range collection.GetItems() {
|
for _, item := range collection.GetItems() {
|
||||||
value := item.GetValue(group.Field)
|
value := item.GetValue(group.Field)
|
||||||
|
|
@ -1353,7 +1353,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
|
||||||
checkAttrView(attrView, view)
|
checkAttrView(attrView, view)
|
||||||
upgradeAttributeViewSpec(attrView)
|
upgradeAttributeViewSpec(attrView)
|
||||||
|
|
||||||
viewable = sql.RenderView(view, attrView, query)
|
viewable = sql.RenderView(attrView, view, query)
|
||||||
err = renderViewableInstance(viewable, view, attrView, page, pageSize)
|
err = renderViewableInstance(viewable, view, attrView, page, pageSize)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
|
@ -1369,7 +1369,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
|
||||||
groupView.Gallery.CardFields = view.Gallery.CardFields
|
groupView.Gallery.CardFields = view.Gallery.CardFields
|
||||||
}
|
}
|
||||||
|
|
||||||
groupViewable := sql.RenderView(groupView, attrView, query)
|
groupViewable := sql.RenderView(attrView, groupView, query)
|
||||||
err = renderViewableInstance(groupViewable, view, attrView, page, pageSize)
|
err = renderViewableInstance(groupViewable, view, attrView, page, pageSize)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
|
@ -2550,7 +2550,7 @@ func addAttributeViewBlock(now int64, avID, blockID, previousBlockID, addingBloc
|
||||||
view, _ := getAttrViewViewByBlockID(attrView, blockID)
|
view, _ := getAttrViewViewByBlockID(attrView, blockID)
|
||||||
|
|
||||||
if nil != view && 0 < len(view.Filters) && !ignoreFillFilter {
|
if nil != view && 0 < len(view.Filters) && !ignoreFillFilter {
|
||||||
viewable := sql.RenderView(view, attrView, "")
|
viewable := sql.RenderView(attrView, view, "")
|
||||||
av.Filter(viewable, attrView)
|
av.Filter(viewable, attrView)
|
||||||
av.Sort(viewable, attrView)
|
av.Sort(viewable, attrView)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RenderView(view *av.View, attrView *av.AttributeView, query string) (ret av.Viewable) {
|
func RenderView(attrView *av.AttributeView, view *av.View, query string) (ret av.Viewable) {
|
||||||
switch view.LayoutType {
|
switch view.LayoutType {
|
||||||
case av.LayoutTypeTable:
|
case av.LayoutTypeTable:
|
||||||
ret = RenderAttributeViewTable(attrView, view, query)
|
ret = RenderAttributeViewTable(attrView, view, query)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue