Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Daniel755e9e0af37a
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index c9ca55fb2c..855d01185a 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -794,6 +794,11 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
if nil == destVal {
continue
}
+ if av.KeyTypeNumber == destVal.Type {
+ destVal.Number.Format = rollupKey.NumberFormat
+ destVal.Number.FormatNumber()
+ }
+
cell.Value.Rollup.Contents = append(cell.Value.Rollup.Contents, destVal.String())
}
case av.KeyTypeRelation: // 渲染关联列
@@ -901,7 +906,7 @@ func updateAttributeViewColRollup(operation *Operation) (err error) {
KeyID: operation.KeyID,
}
- if nil != operation.Data && "" != operation.Data.(string) {
+ if nil != operation.Data {
data := operation.Data.(map[string]interface{})
if nil != data["calc"] {
calcData, jsonErr := gulu.JSON.MarshalJSON(data["calc"])
diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go
index cd9640336e..bbf7924551 100644
--- a/kernel/treenode/node.go
+++ b/kernel/treenode/node.go
@@ -753,6 +753,10 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
if nil == destVal {
continue
}
+ if av.KeyTypeNumber == destVal.Type {
+ destVal.Number.Format = rollupKey.NumberFormat
+ destVal.Number.FormatNumber()
+ }
cell.Value.Rollup.Contents = append(cell.Value.Rollup.Contents, destVal.String())
}
case av.KeyTypeRelation: // 渲染关联列