mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
✨ Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
b357047290
commit
17c59cb2ca
11 changed files with 64 additions and 69 deletions
|
|
@ -85,7 +85,7 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) error {
|
|||
v := av.NewTableView()
|
||||
v.Table = av.NewLayoutTable()
|
||||
for _, row := range rows {
|
||||
v.Table.RowIDs = append(v.Table.RowIDs, row.ID)
|
||||
v.GroupItemIDs = append(v.GroupItemIDs, row.ID)
|
||||
}
|
||||
view.Groups = append(view.Groups, v)
|
||||
}
|
||||
|
|
@ -1285,34 +1285,24 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
|
|||
checkAttrView(attrView, view)
|
||||
upgradeAttributeViewSpec(attrView)
|
||||
|
||||
if nil != view.Group && 0 < len(view.Groups) {
|
||||
var instances []av.Viewable
|
||||
for _, groupView := range view.Groups {
|
||||
groupView.Table.Columns = view.Table.Columns
|
||||
groupViewable := sql.RenderView(groupView, attrView, query)
|
||||
err = renderViewableInstance(groupViewable, view, attrView, page, pageSize)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
instances = append(instances, groupViewable)
|
||||
}
|
||||
|
||||
viewable = instances[0]
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeTable:
|
||||
for i := 1; i < len(instances); i++ {
|
||||
viewable.(*av.Table).Groups = append(viewable.(*av.Table).Groups, instances[i].(*av.Table))
|
||||
}
|
||||
case av.LayoutTypeGallery:
|
||||
for i := 1; i < len(instances); i++ {
|
||||
viewable.(*av.Gallery).Groups = append(viewable.(*av.Gallery).Groups, instances[i].(*av.Gallery))
|
||||
}
|
||||
}
|
||||
viewable = sql.RenderView(view, attrView, query)
|
||||
err = renderViewableInstance(viewable, view, attrView, page, pageSize)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
viewable = sql.RenderView(view, attrView, query)
|
||||
err = renderViewableInstance(viewable, view, attrView, page, pageSize)
|
||||
var groups []av.Viewable
|
||||
for _, groupView := range view.Groups {
|
||||
groupView.Table.Columns = view.Table.Columns
|
||||
groupViewable := sql.RenderView(groupView, attrView, query)
|
||||
err = renderViewableInstance(groupViewable, view, attrView, page, pageSize)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
groups = append(groups, groupViewable)
|
||||
}
|
||||
viewable.SetGroups(groups)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue