From f1089bafa584f663c2bf4c0ceffddb1f6f5e2d27 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 28 Sep 2020 11:03:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-73934=20allPageCounter=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=98=BE=E7=A4=BA=E6=80=BB=E8=A1=8C?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/case/pager/pager.all.count.js | 44 +++++++++++++++++-------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/changelog.md b/changelog.md index c23791f5b..43a9a70ce 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-09) +- allCountPager支持是否显示总行数 - 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 - BI.Tree.traversal方法迭代函数增加父节点参数 diff --git a/src/case/pager/pager.all.count.js b/src/case/pager/pager.all.count.js index 2f6579046..3d191962e 100644 --- a/src/case/pager/pager.all.count.js +++ b/src/case/pager/pager.all.count.js @@ -11,7 +11,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, { height: 24, pages: 1, // 必选项 curr: 1, // 初始化当前页, pages为数字时可用, - count: 1 // 总行数 + count: 1, // 总行数 + showRowCount: true }); }, _init: function () { @@ -101,30 +102,33 @@ BI.AllCountPager = BI.inherit(BI.Widget, { title: o.count }); - var count = BI.createWidget({ - type: "bi.left", - height: o.height, - scrollable: false, - items: [{ - type: "bi.label", - height: o.height, - text: BI.i18nText("BI-Basic_Total"), - width: 15 - }, this.rowCount, { - type: "bi.label", - height: o.height, - text: BI.i18nText("BI-Tiao_Data"), - width: 50, - textAlign: "left" - }] - }); - BI.createWidget({ + BI.createWidget(o.showRowCount ? { type: "bi.left_right_vertical_adapt", element: this, items: { - left: [count], + left: [{ + type: "bi.left", + height: o.height, + scrollable: false, + items: [{ + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Basic_Total"), + width: 15 + }, this.rowCount, { + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Tiao_Data"), + width: 50, + textAlign: "left" + }] + }], right: [this.editor, this.allPages, this.pager] } + } : { + type: "bi.vertical_adapt", + element: this, + items: [this.editor, this.allPages, this.pager] }); }, From dd9ea8c2fe92e90183d0a43186593812963dcaa9 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 28 Sep 2020 13:52:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B6=88=E9=99=A4rowCount=E5=9C=A8checker?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/pager/pager.all.count.js | 67 ++++++++++++++++++------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/src/case/pager/pager.all.count.js b/src/case/pager/pager.all.count.js index 3d191962e..dc0f31d13 100644 --- a/src/case/pager/pager.all.count.js +++ b/src/case/pager/pager.all.count.js @@ -22,7 +22,7 @@ BI.AllCountPager = BI.inherit(BI.Widget, { type: "bi.small_text_editor", cls: "pager-editor bi-border-radius", validationChecker: function (v) { - return (self.rowCount.getValue() === 0 && v === "0") || BI.isPositiveInteger(v); + return (o.pages === 0 && v === "0") || BI.isPositiveInteger(v); }, hgap: 4, vgap: 0, @@ -93,36 +93,11 @@ BI.AllCountPager = BI.inherit(BI.Widget, { invisible: o.pages <= 1 }); - this.rowCount = BI.createWidget({ - type: "bi.label", - cls: "row-count", - height: o.height, - hgap: 5, - text: o.count, - title: o.count - }); - BI.createWidget(o.showRowCount ? { type: "bi.left_right_vertical_adapt", element: this, items: { - left: [{ - type: "bi.left", - height: o.height, - scrollable: false, - items: [{ - type: "bi.label", - height: o.height, - text: BI.i18nText("BI-Basic_Total"), - width: 15 - }, this.rowCount, { - type: "bi.label", - height: o.height, - text: BI.i18nText("BI-Tiao_Data"), - width: 50, - textAlign: "left" - }] - }], + left: [this._getRowCountObject()], right: [this.editor, this.allPages, this.pager] } } : { @@ -151,6 +126,38 @@ BI.AllCountPager = BI.inherit(BI.Widget, { } }, + _getRowCountObject: function() { + var self = this, o = this.options; + + return { + type: "bi.left", + height: o.height, + scrollable: false, + items: [{ + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Basic_Total"), + width: 15 + }, { + type: "bi.label", + ref: function (_ref) { + self.rowCount = _ref; + }, + cls: "row-count", + height: o.height, + hgap: 5, + text: o.count, + title: o.count + }, { + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Tiao_Data"), + width: 50, + textAlign: "left" + }] + }; + }, + setAllPages: function (v) { this.allPages.setText("/" + v); this.allPages.setTitle(v); @@ -169,8 +176,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, { }, setCount: function (count) { - this.rowCount.setText(count); - this.rowCount.setTitle(count); + if (this.options.showRowCount) { + this.rowCount.setText(count); + this.rowCount.setTitle(count); + } }, getCurrentPage: function () {