Browse Source

feature: 选中数据支持分页

es6
guy 2 years ago
parent
commit
03a1a7b2ff
  1. 12
      src/widget/multiselect/loader.js

12
src/widget/multiselect/loader.js

@ -49,8 +49,8 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
this.next.setLoading(); this.next.setLoading();
if (this.cachItems && this.cachItems.length > 0) { if (this.cachItems && this.cachItems.length > 0) {
this.next.setLoaded(); this.next.setLoaded();
this.addItems(this.cachItems.slice(0, 10)); this.addItems(this.cachItems.slice(0, 100));
this.cachItems = this.cachItems.slice(10); this.cachItems = this.cachItems.slice(100);
return; return;
} }
o.itemsCreator.apply(this, [{times: ++this.times}, function () { o.itemsCreator.apply(this, [{times: ++this.times}, function () {
@ -161,7 +161,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
}]); }]);
return false; return false;
} }
this.options.items = (items || []).slice(0, 10); this.options.items = (items || []).slice(0, 100);
this.times = 1; this.times = 1;
this.count = 0; this.count = 0;
this.count += items.length; this.count += items.length;
@ -178,11 +178,11 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
populate: function (items, keyword) { populate: function (items, keyword) {
if (this._populate.apply(this, arguments)) { if (this._populate.apply(this, arguments)) {
this.cachItems = []; this.cachItems = [];
if (items.length > 10) { if (items.length > 100) {
this.cachItems = items.slice(10); this.cachItems = items.slice(100);
} }
this.cachGroup.populate.call(this.cachGroup, items, keyword); this.cachGroup.populate.call(this.cachGroup, items, keyword);
this.button_group.populate.call(this.button_group, items.slice(0, 10), keyword); this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword);
} }
}, },

Loading…
Cancel
Save