mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958
This commit is contained in:
parent
93dc9f5c22
commit
0ce8b58a79
3 changed files with 110 additions and 13 deletions
|
|
@ -723,6 +723,30 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
}
|
||||
content := renderTemplateCol(ial, cell.Value.Template.Content, keyValues)
|
||||
cell.Value.Template.Content = content
|
||||
case av.KeyTypeRollup: // 渲染汇总列
|
||||
rollupKey, _ := attrView.GetKey(cell.Value.KeyID)
|
||||
if nil == rollupKey || nil == rollupKey.Rollup {
|
||||
break
|
||||
}
|
||||
|
||||
relKey, _ := attrView.GetKey(rollupKey.Rollup.RelationKeyID)
|
||||
if nil == relKey || nil == relKey.Relation {
|
||||
break
|
||||
}
|
||||
|
||||
relVal := attrView.GetValue(relKey.ID, row.ID)
|
||||
if nil == relVal || nil == relVal.Relation {
|
||||
break
|
||||
}
|
||||
|
||||
destAv, _ := av.ParseAttributeView(relKey.Relation.AvID)
|
||||
if nil == destAv {
|
||||
break
|
||||
}
|
||||
|
||||
for _, blockID := range relVal.Relation.BlockIDs {
|
||||
cell.Value.Rollup.Contents = append(cell.Value.Rollup.Contents, destAv.GetValue(rollupKey.Rollup.KeyID, blockID).String())
|
||||
}
|
||||
case av.KeyTypeRelation: // 渲染关联列
|
||||
relKey, _ := attrView.GetKey(cell.Value.KeyID)
|
||||
if nil != relKey && nil != relKey.Relation {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue