Skip to content

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

:art: Attribute Panel - Database sort attributes by view column order https://github.com/siyuan-note/siyuan/issues/9319

Danielca855c1fa547
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 0097bc5cd7..ea549adbea 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -76,6 +76,19 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
}
}
+ // Attribute Panel - Database sort attributes by view column order https://github.com/siyuan-note/siyuan/issues/9319
+ view, _ := attrView.GetView()
+ if nil != view {
+ sorts := map[string]int{}
+ for i, col := range view.Table.Columns {
+ sorts[col.ID] = i
+ }
+
+ sort.Slice(keyValues, func(i, j int) bool {
+ return sorts[keyValues[i].Key.ID] < sorts[keyValues[j].Key.ID]
+ })
+ }
+
ret = append(ret, &BlockAttributeViewKeys{
AvID: avID,
AvName: attrView.Name,