An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve database table view template column sorting https://github.com/siyuan-note/siyuan/issues/9914
Danielfe88ac105dc2
diff --git a/kernel/av/table.go b/kernel/av/table.goindex c518ad4c03..66b2977574 100644--- a/kernel/av/table.go+++ b/kernel/av/table.go@@ -21,6 +21,8 @@ import ("sort""strconv""strings"++ "github.com/siyuan-note/siyuan/kernel/util")// LayoutTable 描述了表格布局的结构。@@ -174,6 +176,18 @@ func (value *Value) Compare(other *Value) int {}case KeyTypeTemplate:if nil != value.Template && nil != other.Template {+ if util.IsNumeric(value.Template.Content) && util.IsNumeric(other.Template.Content) {+ v1, _ := strconv.ParseFloat(value.Template.Content, 64)+ v2, _ := strconv.ParseFloat(other.Template.Content, 64)+ if v1 > v2 {+ return 1+ }++ if v1 < v2 {+ return -1+ }+ return 0+ }return strings.Compare(value.Template.Content, other.Template.Content)}case KeyTypeCheckbox:diff --git a/kernel/util/misc.go b/kernel/util/misc.goindex 9eea724d71..ef6623fcd1 100644--- a/kernel/util/misc.go+++ b/kernel/util/misc.go@@ -18,6 +18,7 @@ package utilimport ("bytes"+ "strconv""strings""unicode"@@ -82,3 +83,8 @@ func RemoveRedundantSpace(str string) string {}return buf.String()}++func IsNumeric(s string) bool {+ _, err := strconv.ParseFloat(s, 64)+ return err == nil+}