diff --git a/core/model/Model.js b/core/model/Model.js index 9bdc468cb..824a12752 100644 --- a/core/model/Model.js +++ b/core/model/Model.js @@ -377,15 +377,15 @@ define([ }, _sizeAll: function(parentId){ - var size = this.size(parentId), i, childId, - count = 0; + var size = this.size(parentId), + count = 0, + i, childId; size = size === -1 ? 0 : size; count += size; - for(i = 0; i < size; i++){ + for(i = 0; i < size; i++) { childId = this.indexToId(i, parentId); - console.log(childId); count += this._sizeAll(childId); } diff --git a/core/model/extensions/Modify.js b/core/model/extensions/Modify.js index 3552b4429..a29281c5f 100644 --- a/core/model/extensions/Modify.js +++ b/core/model/extensions/Modify.js @@ -140,10 +140,13 @@ define([ byId: function(id){ var t = this, c = t.inner._call('byId', arguments); - if(!c){ return c; } + if(!c) return c; var d = lang.mixin({}, c); + d.rawData = lang.mixin({}, d.rawData, t._lazyRawData[id]); - d.data = lang.mixin({}, d.data, t._lazyData[id]); + if (d.data) { + d.data = lang.mixin({}, d.data, t._lazyData[id]); + } return d; }, @@ -151,11 +154,14 @@ define([ var t = this, c = t.inner._call('byIndex', arguments), id = t.inner._call('indexToId', arguments); - if(!c){ return c; } + + if(!c) return c; var d = lang.mixin({}, c); d.rawData = lang.mixin({}, d.rawData, t._lazyRawData[id]); - d.data = lang.mixin({}, d.data, t._lazyData[id]); + if (d.data) { + d.data = lang.mixin({}, d.data, t._lazyData[id]); + } return d; }, diff --git a/support/Summary.js b/support/Summary.js index d990fa871..9bab91455 100644 --- a/support/Summary.js +++ b/support/Summary.js @@ -54,6 +54,11 @@ define([ firstIdx = 0, lastIdx = 0; + if (g.sizeHandler && typeof g.sizeHandler === 'function') { + size = g.sizeHandler(g); + } + + size = g.tree? g.model._sizeAll() : size; if(pagination){ cp = pagination.currentPage(); firstIdx = pagination.firstIndexInPage(cp) + 1; diff --git a/tests/support/common.css b/tests/support/common.css index 0cf90a083..597dfb096 100644 --- a/tests/support/common.css +++ b/tests/support/common.css @@ -11,6 +11,12 @@ body { margin: 5em; } +h3 { + color: blue; + margin: 0; + padding: 0; +} + .title { font-size: large; font-weight: bolder; diff --git a/tests/test_grid_pagination.html b/tests/test_grid_pagination.html index ee9d31b8c..7c0c5a0a4 100644 --- a/tests/test_grid_pagination.html +++ b/tests/test_grid_pagination.html @@ -36,10 +36,16 @@

Pagination Grid with API only

] '>

Link-button style PaginationBar

+

using self defined size handler to calculate row count