Sourcecode in Global/renderFunctions.js:
1: function renderList(collection, funcOrSkin, itemsPerPage, pageIdx) {
2: var currIdx = 0;
3: var isArray = collection instanceof Array;
4: var stop = size = isArray ? collection.length : collection.size();
5:
6: if (itemsPerPage) {
7: var totalPages = Math.ceil(size/itemsPerPage);
8: if (isNaN(pageIdx) || pageIdx > totalPages || pageIdx < 0)
9: pageIdx = 0;
10: currIdx = pageIdx * itemsPerPage;
11: stop = Math.min(currIdx + itemsPerPage, size);
12: }
13: var isFunction = (funcOrSkin instanceof Function) ? true : false;
14: res.push();
15: while (currIdx < stop) {
16: var item = isArray ? collection[currIdx] : collection.get(currIdx);
17: isFunction ? funcOrSkin(item) : item.renderSkin(funcOrSkin);
18: currIdx++;
19: }
20: return res.pop();
21: }
|