diff --git a/src/widget/multiselect/check/multiselect.display.js b/src/widget/multiselect/check/multiselect.display.js index 337afd59f..b5b4f76e8 100644 --- a/src/widget/multiselect/check/multiselect.display.js +++ b/src/widget/multiselect/check/multiselect.display.js @@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { var self = this, opts = this.options; this.hasNext = false; + var cacheItems = []; this.button_group = BI.createWidget({ type: "bi.list_pane", @@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { }] }, 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) { 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 () {