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 Jan 16, 2015
2 parents 7c147e1 + d462c7a commit 175a16b
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 105 deletions.
6 changes: 5 additions & 1 deletion Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define([
// - revision: Number: The Git rev from which dojo was pulled
major: 1,
minor: 3,
patch: 6,
patch: 7,
flag: "",
toString: function(){
return this.major + "." + this.minor + "." + this.patch + this.flag; // String
Expand All @@ -66,6 +66,10 @@ define([
templateString: template,

version: version,

isIE: has('ie') || has('trident'),


//textDir bidi support begin
_setTextDirAttr: function(textDir){
// summary:
Expand Down
8 changes: 4 additions & 4 deletions core/model/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ define([
},

//Events---------------------------------------------------------------------------------
onDelete: function(/*id, index*/){},
onDelete: function(/*id, index*/) {},

onNew: function(/*id, index, row*/){},
onNew: function(/*id, index, row*/) {},

onSet: function(/*id, index, row*/){},
onSet: function(/*id, index, row*/) {},

onSizeChange: function(/*size, oldSize*/){},
onSizeChange: function(/*size, oldSize*/) {},

//Package----------------------------------------------------------------------------
_msg: function(/* msg */){},
Expand Down
10 changes: 7 additions & 3 deletions core/model/cache/Sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,20 @@ define([
},

//--------------------------------------------------------------------------
_onSet: function(item){
_onSet: function(item, option) {
var t = this,
id = t.store.getIdentity(item),
index = t.idToIndex(id),
path = t.treePath(id),
old = t._cache[id];
if(path.length){

if (path.length) {
t._addRow(id, index, t._itemToObject(item), item, path.pop());
}
t.onSet(id, index, t._cache[id], old);
if (!option || option.overwrite !== false) { // In new store, add() is using put().
// Here to stop t.onSet when calling store.add()
t.onSet(id, index, t._cache[id], old);
}
},

_onNew: function(item, parentInfo){
Expand Down
36 changes: 29 additions & 7 deletions core/model/extensions/Mark.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ define([
_fireEvent: function(id, type, toMark, oldState){
var t = this,
m = t.model;
// debugger;
if(toMark != oldState){
if(!toMark){
delete t._byId[type][id];
Expand Down Expand Up @@ -317,7 +318,7 @@ define([
},

_doMark: function(id, tp, toMark, skipParent, noEvent){
var i, ids, children, childId, treePath,
var i, ids, children, childId, treePath, childrenLen,
t = this,
m = t.model,
mm = m._model,
Expand All @@ -326,15 +327,28 @@ define([
lazy = t._lazy[tp],
// selectable = t._byId['selectable'],
oldState = byId[id] || 0,
newState;
newState, parent;

if(t._tree[tp]){
children = mm._call('children', [id]);
if(toMark == 1 && array.every(children, function(childId){
return (last[childId] || 0) == (last[children[0]] || 0);
})){
toMark = 2;
childrenLen = children.length;

if (toMark === 1) {
if (childrenLen > 1) {
if(array.every(children, function(childId){
return (last[childId] || 0) == (last[children[0]] || 0);
})){
toMark = 2;
}

} else if(childrenLen === 1) {
toMark = last[children[0]] === 1 ? 1 : 2;
} else { //without children rows
toMark = 2;
}
}
}

byId[id] = last[id] = toMark;
if(!noEvent){
t._fireEvent(id, tp, toMark, oldState);
Expand All @@ -344,7 +358,15 @@ define([
while(ids.length){
childId = ids.shift();
oldState = byId[childId] || 0;
newState = byId[childId] = toMark == 1 ? last[childId] || 0 : toMark;
newState = byId[childId] = toMark == 1 ? last[childId] || undefined : toMark;

if (newState === undefined) {
parent = mm._call('treePath', [childId]);
newState = byId[parent.pop()];
newState = newState === 1 ? 0 : newState;
byId[childId] = newState;
}

if(!noEvent){
t._fireEvent(childId, tp, newState, oldState);
}
Expand Down
13 changes: 10 additions & 3 deletions modules/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,10 @@ define([
//Set a special flag so that RowHeader won't destroy its nodes.
//FIXME: this is ugly...
t.onUnrender(id, 'refresh');
t.renderedIds[id] = undefined;
}
domConstruct.destroy(n);
t.renderedIds[id] = undefined;
// t.renderedIds[id] = undefined;
n = tmp;
}
array.forEach(renderedRows, t.onAfterRow, t);
Expand Down Expand Up @@ -975,6 +976,12 @@ define([
e.columnId = col.id;
e.columnIndex = col.index;
}
if(tag == 'div' && domClass.contains(n, 'gridxRow') && n.parentNode === g.bodyNode){
e.rowId = n.getAttribute('rowid');
e.parentId = n.getAttribute('parentid');
e.rowIndex = parseInt(n.getAttribute('rowindex'), 10);
e.visualIndex = parseInt(n.getAttribute('visualindex'), 10);
}
if(tag == 'table' && domClass.contains(n, 'gridxRowTable') && n.parentNode.parentNode === g.bodyNode){
n = n.parentNode;
e.rowId = n.getAttribute('rowid');
Expand Down Expand Up @@ -1002,8 +1009,8 @@ define([
row = g.row(id, 1),
rowNode = row && row.node();
if(rowNode){
var curData = rowCache.data,
oldData = oldCache.data,
var curData = rowCache.data || rowCache._data(),
oldData = oldCache.data || oldCache._data(),
cols = g._columns,
renderWhole = t.arg('renderWholeRowOnSet'),
compareOnSet = t.arg('compareOnSet');
Expand Down
Loading

0 comments on commit 175a16b

Please sign in to comment.