Skip to content

Commit

Permalink
Merge branch 'master' into 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yurychika committed Dec 26, 2014
2 parents 3d3d763 + 7e95f80 commit 7c147e1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
8 changes: 4 additions & 4 deletions core/model/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
14 changes: 10 additions & 4 deletions core/model/extensions/Modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,28 @@ 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;
},

byIndex: function(index, parentId){
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;
},

Expand Down
5 changes: 5 additions & 0 deletions support/Summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions tests/support/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ body {
margin: 5em;
}

h3 {
color: blue;
margin: 0;
padding: 0;
}

.title {
font-size: large;
font-weight: bolder;
Expand Down
6 changes: 6 additions & 0 deletions tests/test_grid_pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ <h2>Pagination Grid with API only</h2>
]
'></div>
<h2>Link-button style PaginationBar</h2>
<h3>using self defined size handler to calculate row count</h3>
<div id='grid2' jsid='grid2' data-dojo-type='gridx.Grid' data-dojo-props='
cacheClass: "gridx/core/model/cache/Sync",
store: store,
structure: layout,
//self defined size handler
sizeHandler: function() {
console.log("in size handler");
return 123;
},
paginationBarMessage: "${2} to ${3} of ${0} items ${1} items selected",
modules: [
"gridx/modules/Pagination",
Expand Down

0 comments on commit 7c147e1

Please sign in to comment.