🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958

This commit is contained in:
Daniel 2024-01-01 16:27:01 +08:00
parent 5c8bab48ed
commit b296771340
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 22 additions and 30 deletions

View file

@ -774,18 +774,14 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
break
}
for _, blockID := range relVal.Relation.BlockIDs {
destKey, _ := destAv.GetKey(rollupKey.Rollup.KeyID)
if nil == destKey {
continue
}
destKey, _ := destAv.GetKey(rollupKey.Rollup.KeyID)
if nil == destKey {
continue
}
for _, blockID := range relVal.Relation.BlockIDs {
destVal := destAv.GetValue(rollupKey.Rollup.KeyID, blockID)
if nil == destVal {
if nil == destKey {
continue
}
destVal = GetAttributeViewDefaultValue(ast.NewNodeID(), rollupKey.Rollup.KeyID, blockID, destKey.Type)
}
if av.KeyTypeNumber == destKey.Type {
@ -796,7 +792,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
cell.Value.Rollup.Contents = append(cell.Value.Rollup.Contents, destVal.Clone())
}
cell.Value.Rollup.RenderContents(rollupKey.Rollup.Calc)
cell.Value.Rollup.RenderContents(rollupKey.Rollup.Calc, destKey)
case av.KeyTypeRelation: // 渲染关联列
relKey, _ := attrView.GetKey(cell.Value.KeyID)
if nil != relKey && nil != relKey.Relation {