Skip to content

Commit 7c147e1

Browse files
committed
Merge branch 'master' into 1.3
2 parents 3d3d763 + 7e95f80 commit 7c147e1

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

core/model/Model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,15 @@ define([
377377
},
378378

379379
_sizeAll: function(parentId){
380-
var size = this.size(parentId), i, childId,
381-
count = 0;
380+
var size = this.size(parentId),
381+
count = 0,
382+
i, childId;
382383

383384
size = size === -1 ? 0 : size;
384385
count += size;
385386

386-
for(i = 0; i < size; i++){
387+
for(i = 0; i < size; i++) {
387388
childId = this.indexToId(i, parentId);
388-
console.log(childId);
389389
count += this._sizeAll(childId);
390390
}
391391

core/model/extensions/Modify.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,28 @@ define([
140140
byId: function(id){
141141
var t = this,
142142
c = t.inner._call('byId', arguments);
143-
if(!c){ return c; }
143+
if(!c) return c;
144144
var d = lang.mixin({}, c);
145+
145146
d.rawData = lang.mixin({}, d.rawData, t._lazyRawData[id]);
146-
d.data = lang.mixin({}, d.data, t._lazyData[id]);
147+
if (d.data) {
148+
d.data = lang.mixin({}, d.data, t._lazyData[id]);
149+
}
147150
return d;
148151
},
149152

150153
byIndex: function(index, parentId){
151154
var t = this,
152155
c = t.inner._call('byIndex', arguments),
153156
id = t.inner._call('indexToId', arguments);
154-
if(!c){ return c; }
157+
158+
if(!c) return c;
155159
var d = lang.mixin({}, c);
156160

157161
d.rawData = lang.mixin({}, d.rawData, t._lazyRawData[id]);
158-
d.data = lang.mixin({}, d.data, t._lazyData[id]);
162+
if (d.data) {
163+
d.data = lang.mixin({}, d.data, t._lazyData[id]);
164+
}
159165
return d;
160166
},
161167

support/Summary.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ define([
5454
firstIdx = 0,
5555
lastIdx = 0;
5656

57+
if (g.sizeHandler && typeof g.sizeHandler === 'function') {
58+
size = g.sizeHandler(g);
59+
}
60+
61+
size = g.tree? g.model._sizeAll() : size;
5762
if(pagination){
5863
cp = pagination.currentPage();
5964
firstIdx = pagination.firstIndexInPage(cp) + 1;

tests/support/common.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ body {
1111
margin: 5em;
1212
}
1313

14+
h3 {
15+
color: blue;
16+
margin: 0;
17+
padding: 0;
18+
}
19+
1420
.title {
1521
font-size: large;
1622
font-weight: bolder;

tests/test_grid_pagination.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ <h2>Pagination Grid with API only</h2>
3636
]
3737
'></div>
3838
<h2>Link-button style PaginationBar</h2>
39+
<h3>using self defined size handler to calculate row count</h3>
3940
<div id='grid2' jsid='grid2' data-dojo-type='gridx.Grid' data-dojo-props='
4041
cacheClass: "gridx/core/model/cache/Sync",
4142
store: store,
4243
structure: layout,
44+
//self defined size handler
45+
sizeHandler: function() {
46+
console.log("in size handler");
47+
return 123;
48+
},
4349
paginationBarMessage: "${2} to ${3} of ${0} items ${1} items selected",
4450
modules: [
4551
"gridx/modules/Pagination",

0 commit comments

Comments
 (0)