|
|
@ -21,13 +21,13 @@ BI.ListView = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
init: function () { |
|
|
|
init: function () { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
this.renderedIndex = -1; |
|
|
|
this.renderedIndex = -1; |
|
|
|
this.cache = {}; |
|
|
|
this.cache = {}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: "bi.vertical", |
|
|
|
type: "bi.vertical", |
|
|
|
items: [BI.extend({ |
|
|
|
items: [BI.extend({ |
|
|
@ -72,10 +72,11 @@ BI.ListView = BI.inherit(BI.Widget, { |
|
|
|
var index = (this.cache[this.renderedIndex] && (this.cache[this.renderedIndex].index + o.blockSize)) || 0; |
|
|
|
var index = (this.cache[this.renderedIndex] && (this.cache[this.renderedIndex].index + o.blockSize)) || 0; |
|
|
|
var cnt = this.renderedIndex + 1; |
|
|
|
var cnt = this.renderedIndex + 1; |
|
|
|
var lastHeight; |
|
|
|
var lastHeight; |
|
|
|
var getElementHeight = function () { |
|
|
|
function getElementHeight () { |
|
|
|
return self.container.element.height(); |
|
|
|
return self.container.element.height(); |
|
|
|
}; |
|
|
|
} |
|
|
|
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) { |
|
|
|
lastHeight = getElementHeight(); |
|
|
|
|
|
|
|
while ((lastHeight) < minContentHeight && index < o.items.length) { |
|
|
|
var items = o.items.slice(index, index + o.blockSize); |
|
|
|
var items = o.items.slice(index, index + o.blockSize); |
|
|
|
this.container.addItems(items.map(function (item, i) { |
|
|
|
this.container.addItems(items.map(function (item, i) { |
|
|
|
return o.itemFormatter(item, index + i); |
|
|
|
return o.itemFormatter(item, index + i); |
|
|
@ -93,7 +94,6 @@ BI.ListView = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_calculateBlocksToRender: function () { |
|
|
|
_calculateBlocksToRender: function () { |
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
this._renderMoreIf(); |
|
|
|
this._renderMoreIf(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|