Browse Source

Pull request #3135: BI-115516 check面板也处理下

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '5c9b9a34fb2f8bbbe092e53113df6b8e47f98f80':
  BI-115516 check面板也处理下
es6
guy-王川 2 years ago
parent
commit
7a2cd929b9
  1. 22
      src/widget/multiselect/check/multiselect.display.js

22
src/widget/multiselect/check/multiselect.display.js

@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
var self = this, opts = this.options; var self = this, opts = this.options;
this.hasNext = false; this.hasNext = false;
var cacheItems = [];
this.button_group = BI.createWidget({ this.button_group = BI.createWidget({
type: "bi.list_pane", type: "bi.list_pane",
@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
}] }]
}, },
itemsCreator: function (options, callback) { itemsCreator: function (options, callback) {
if (options.times === 1) {
cacheItems = [];
}
if (cacheItems.length > 0) {
var renderedItems = cacheItems.slice(0, 100);
cacheItems = cacheItems.slice(100);
self.hasNext = true;
if (cacheItems.length === 0) {
self.hasNext = false;
}
callback(self._createItems(renderedItems));
return;
}
opts.itemsCreator(options, function (ob) { opts.itemsCreator(options, function (ob) {
self.hasNext = !!ob.hasNext; self.hasNext = !!ob.hasNext;
callback(self._createItems(ob.items)); var firstItemsCount = 100 + ob.items.length % 100;
if (ob.items.length > 100) {
cacheItems = ob.items.slice(100 + ob.items.length % 100);
self.hasNext = true;
}
callback(self._createItems(ob.items.slice(0, firstItemsCount)));
}); });
}, },
hasNext: function () { hasNext: function () {

Loading…
Cancel
Save