Browse Source

消除rowCount在checker中的作用

es6
windy 4 years ago
parent
commit
dd9ea8c2fe
  1. 67
      src/case/pager/pager.all.count.js

67
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 () {

Loading…
Cancel
Save