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: Database table view supports paged loading https://github.com/siyuan-note/siyuan/issues/9424
Daniel79960b4da2f1
diff --git a/kernel/av/table.go b/kernel/av/table.goindex 1e2133bc7d..9859803222 100644--- a/kernel/av/table.go+++ b/kernel/av/table.go@@ -28,10 +28,11 @@ type LayoutTable struct {Spec int `json:"spec"` // 布局格式版本ID string `json:"id"` // 布局 ID- Columns []*ViewTableColumn `json:"columns"` // 表格列- RowIDs []string `json:"rowIds"` // 行 ID,用于自定义排序- Filters []*ViewFilter `json:"filters"` // 过滤规则- Sorts []*ViewSort `json:"sorts"` // 排序规则+ Columns []*ViewTableColumn `json:"columns"` // 表格列+ RowIDs []string `json:"rowIds"` // 行 ID,用于自定义排序+ Filters []*ViewFilter `json:"filters"` // 过滤规则+ Sorts []*ViewSort `json:"sorts"` // 排序规则+ PageSize int `json:"pageSize"` // 每页行数}type ViewTableColumn struct {@@ -571,13 +572,14 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool// Table 描述了表格实例的结构。type Table struct {- ID string `json:"id"` // 表格布局 ID- Icon string `json:"icon"` // 表格图标- Name string `json:"name"` // 表格名称- Filters []*ViewFilter `json:"filters"` // 过滤规则- Sorts []*ViewSort `json:"sorts"` // 排序规则- Columns []*TableColumn `json:"columns"` // 表格列- Rows []*TableRow `json:"rows"` // 表格行+ ID string `json:"id"` // 表格布局 ID+ Icon string `json:"icon"` // 表格图标+ Name string `json:"name"` // 表格名称+ Filters []*ViewFilter `json:"filters"` // 过滤规则+ Sorts []*ViewSort `json:"sorts"` // 排序规则+ Columns []*TableColumn `json:"columns"` // 表格列+ Rows []*TableRow `json:"rows"` // 表格行+ RowCount int `json:"rowCount"` // 表格总行数}type TableColumn struct {diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 4208946c42..f70bf88673 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -622,6 +622,8 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, page, preturn iv < jv})+ // 分页+ ret.RowCount = len(ret.Rows)if 0 < pageSize {start := (page - 1) * pageSizeend := start + pageSize@@ -959,6 +961,34 @@ func setAttributeViewSorts(operation *Operation) (err error) {return}+func (tx *Transaction) doSetAttrViewPageSize(operation *Operation) (ret *TxErr) {+ err := setAttributeViewPageSize(operation)+ if nil != err {+ return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}+ }+ return+}++func setAttributeViewPageSize(operation *Operation) (err error) {+ attrView, err := av.ParseAttributeView(operation.AvID)+ if nil != err {+ return+ }++ view, err := attrView.GetCurrentView()+ if nil != err {+ return+ }++ switch view.LayoutType {+ case av.LayoutTypeTable:+ view.Table.PageSize = int(operation.Data.(float64))+ }++ err = av.SaveAttributeView(attrView)+ return+}+func (tx *Transaction) doSetAttrViewColCalc(operation *Operation) (ret *TxErr) {err := setAttributeViewColumnCalc(operation)if nil != err {diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex f53ec646ec..6bc09252d8 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -204,6 +204,8 @@ func performTx(tx *Transaction) (ret *TxErr) {ret = tx.doSetAttrViewFilters(op)case "setAttrViewSorts":ret = tx.doSetAttrViewSorts(op)+ case "setAttrViewPageSize":+ ret = tx.doSetAttrViewPageSize(op)case "setAttrViewColWidth":ret = tx.doSetAttrViewColumnWidth(op)case "setAttrViewColWrap":