From 305f781afa31c2bdeb43b08b9d5ccca3abb8faf0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 20 Dec 2023 11:12:31 +0800 Subject: [PATCH] :art: Improve database table view template col sorting https://ld246.com/article/1702871433047 --- kernel/av/table.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/av/table.go b/kernel/av/table.go index 1370a18a4..69b161efe 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -176,9 +176,11 @@ 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) + vContent := strings.TrimSpace(value.Template.Content) + oContent := strings.TrimSpace(other.Template.Content) + if util.IsNumeric(vContent) && util.IsNumeric(oContent) { + v1, _ := strconv.ParseFloat(vContent, 64) + v2, _ := strconv.ParseFloat(oContent, 64) if v1 > v2 { return 1 }