Browse Source

Pull request #1520: BI-73934 allPageCounter支持自定义显示总行数(为表总行数新交互服务)

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit 'dd9ea8c2fe92e90183d0a43186593812963dcaa9':
  消除rowCount在checker中的作用
  BI-73934 allPageCounter支持自定义显示总行数
es6
windy 4 years ago
parent
commit
b0ba3eee81
  1. 1
      changelog.md
  2. 77
      src/case/pager/pager.all.count.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-09) 2.0(2020-09)
- allCountPager支持是否显示总行数
- 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复区间滑块setEnable(false)滑块不灰化的问题
- 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题
- BI.Tree.traversal方法迭代函数增加父节点参数 - BI.Tree.traversal方法迭代函数增加父节点参数

77
src/case/pager/pager.all.count.js

@ -11,7 +11,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
height: 24, height: 24,
pages: 1, // 必选项 pages: 1, // 必选项
curr: 1, // 初始化当前页, pages为数字时可用, curr: 1, // 初始化当前页, pages为数字时可用,
count: 1 // 总行数 count: 1, // 总行数
showRowCount: true
}); });
}, },
_init: function () { _init: function () {
@ -21,7 +22,7 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
type: "bi.small_text_editor", type: "bi.small_text_editor",
cls: "pager-editor bi-border-radius", cls: "pager-editor bi-border-radius",
validationChecker: function (v) { validationChecker: function (v) {
return (self.rowCount.getValue() === 0 && v === "0") || BI.isPositiveInteger(v); return (o.pages === 0 && v === "0") || BI.isPositiveInteger(v);
}, },
hgap: 4, hgap: 4,
vgap: 0, vgap: 0,
@ -92,39 +93,17 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
invisible: o.pages <= 1 invisible: o.pages <= 1
}); });
this.rowCount = BI.createWidget({ BI.createWidget(o.showRowCount ? {
type: "bi.label",
cls: "row-count",
height: o.height,
hgap: 5,
text: o.count,
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({
type: "bi.left_right_vertical_adapt", type: "bi.left_right_vertical_adapt",
element: this, element: this,
items: { items: {
left: [count], left: [this._getRowCountObject()],
right: [this.editor, this.allPages, this.pager] right: [this.editor, this.allPages, this.pager]
} }
} : {
type: "bi.vertical_adapt",
element: this,
items: [this.editor, this.allPages, this.pager]
}); });
}, },
@ -147,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) { setAllPages: function (v) {
this.allPages.setText("/" + v); this.allPages.setText("/" + v);
this.allPages.setTitle(v); this.allPages.setTitle(v);
@ -165,8 +176,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
}, },
setCount: function (count) { setCount: function (count) {
this.rowCount.setText(count); if (this.options.showRowCount) {
this.rowCount.setTitle(count); this.rowCount.setText(count);
this.rowCount.setTitle(count);
}
}, },
getCurrentPage: function () { getCurrentPage: function () {

Loading…
Cancel
Save