Skip to content

Commit 175a16b

Browse files
committed
Merge branch 'master' into 1.3
2 parents 7c147e1 + d462c7a commit 175a16b

File tree

16 files changed

+230
-105
lines changed

16 files changed

+230
-105
lines changed

Grid.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define([
4949
// - revision: Number: The Git rev from which dojo was pulled
5050
major: 1,
5151
minor: 3,
52-
patch: 6,
52+
patch: 7,
5353
flag: "",
5454
toString: function(){
5555
return this.major + "." + this.minor + "." + this.patch + this.flag; // String
@@ -66,6 +66,10 @@ define([
6666
templateString: template,
6767

6868
version: version,
69+
70+
isIE: has('ie') || has('trident'),
71+
72+
6973
//textDir bidi support begin
7074
_setTextDirAttr: function(textDir){
7175
// summary:

core/model/Model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ define([
393393
},
394394

395395
//Events---------------------------------------------------------------------------------
396-
onDelete: function(/*id, index*/){},
396+
onDelete: function(/*id, index*/) {},
397397

398-
onNew: function(/*id, index, row*/){},
398+
onNew: function(/*id, index, row*/) {},
399399

400-
onSet: function(/*id, index, row*/){},
400+
onSet: function(/*id, index, row*/) {},
401401

402-
onSizeChange: function(/*size, oldSize*/){},
402+
onSizeChange: function(/*size, oldSize*/) {},
403403

404404
//Package----------------------------------------------------------------------------
405405
_msg: function(/* msg */){},

core/model/cache/Sync.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,20 @@ define([
409409
},
410410

411411
//--------------------------------------------------------------------------
412-
_onSet: function(item){
412+
_onSet: function(item, option) {
413413
var t = this,
414414
id = t.store.getIdentity(item),
415415
index = t.idToIndex(id),
416416
path = t.treePath(id),
417417
old = t._cache[id];
418-
if(path.length){
418+
419+
if (path.length) {
419420
t._addRow(id, index, t._itemToObject(item), item, path.pop());
420421
}
421-
t.onSet(id, index, t._cache[id], old);
422+
if (!option || option.overwrite !== false) { // In new store, add() is using put().
423+
// Here to stop t.onSet when calling store.add()
424+
t.onSet(id, index, t._cache[id], old);
425+
}
422426
},
423427

424428
_onNew: function(item, parentInfo){

core/model/extensions/Mark.js

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ define([
274274
_fireEvent: function(id, type, toMark, oldState){
275275
var t = this,
276276
m = t.model;
277+
// debugger;
277278
if(toMark != oldState){
278279
if(!toMark){
279280
delete t._byId[type][id];
@@ -317,7 +318,7 @@ define([
317318
},
318319

319320
_doMark: function(id, tp, toMark, skipParent, noEvent){
320-
var i, ids, children, childId, treePath,
321+
var i, ids, children, childId, treePath, childrenLen,
321322
t = this,
322323
m = t.model,
323324
mm = m._model,
@@ -326,15 +327,28 @@ define([
326327
lazy = t._lazy[tp],
327328
// selectable = t._byId['selectable'],
328329
oldState = byId[id] || 0,
329-
newState;
330+
newState, parent;
331+
330332
if(t._tree[tp]){
331333
children = mm._call('children', [id]);
332-
if(toMark == 1 && array.every(children, function(childId){
333-
return (last[childId] || 0) == (last[children[0]] || 0);
334-
})){
335-
toMark = 2;
334+
childrenLen = children.length;
335+
336+
if (toMark === 1) {
337+
if (childrenLen > 1) {
338+
if(array.every(children, function(childId){
339+
return (last[childId] || 0) == (last[children[0]] || 0);
340+
})){
341+
toMark = 2;
342+
}
343+
344+
} else if(childrenLen === 1) {
345+
toMark = last[children[0]] === 1 ? 1 : 2;
346+
} else { //without children rows
347+
toMark = 2;
348+
}
336349
}
337350
}
351+
338352
byId[id] = last[id] = toMark;
339353
if(!noEvent){
340354
t._fireEvent(id, tp, toMark, oldState);
@@ -344,7 +358,15 @@ define([
344358
while(ids.length){
345359
childId = ids.shift();
346360
oldState = byId[childId] || 0;
347-
newState = byId[childId] = toMark == 1 ? last[childId] || 0 : toMark;
361+
newState = byId[childId] = toMark == 1 ? last[childId] || undefined : toMark;
362+
363+
if (newState === undefined) {
364+
parent = mm._call('treePath', [childId]);
365+
newState = byId[parent.pop()];
366+
newState = newState === 1 ? 0 : newState;
367+
byId[childId] = newState;
368+
}
369+
348370
if(!noEvent){
349371
t._fireEvent(childId, tp, newState, oldState);
350372
}

modules/Body.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,10 @@ define([
462462
//Set a special flag so that RowHeader won't destroy its nodes.
463463
//FIXME: this is ugly...
464464
t.onUnrender(id, 'refresh');
465+
t.renderedIds[id] = undefined;
465466
}
466467
domConstruct.destroy(n);
467-
t.renderedIds[id] = undefined;
468+
// t.renderedIds[id] = undefined;
468469
n = tmp;
469470
}
470471
array.forEach(renderedRows, t.onAfterRow, t);
@@ -975,6 +976,12 @@ define([
975976
e.columnId = col.id;
976977
e.columnIndex = col.index;
977978
}
979+
if(tag == 'div' && domClass.contains(n, 'gridxRow') && n.parentNode === g.bodyNode){
980+
e.rowId = n.getAttribute('rowid');
981+
e.parentId = n.getAttribute('parentid');
982+
e.rowIndex = parseInt(n.getAttribute('rowindex'), 10);
983+
e.visualIndex = parseInt(n.getAttribute('visualindex'), 10);
984+
}
978985
if(tag == 'table' && domClass.contains(n, 'gridxRowTable') && n.parentNode.parentNode === g.bodyNode){
979986
n = n.parentNode;
980987
e.rowId = n.getAttribute('rowid');
@@ -1002,8 +1009,8 @@ define([
10021009
row = g.row(id, 1),
10031010
rowNode = row && row.node();
10041011
if(rowNode){
1005-
var curData = rowCache.data,
1006-
oldData = oldCache.data,
1012+
var curData = rowCache.data || rowCache._data(),
1013+
oldData = oldCache.data || oldCache._data(),
10071014
cols = g._columns,
10081015
renderWhole = t.arg('renderWholeRowOnSet'),
10091016
compareOnSet = t.arg('compareOnSet');

0 commit comments

Comments
 (0)