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 Nov 6, 2014
2 parents 2002490 + f6dcd4c commit 70536b7
Show file tree
Hide file tree
Showing 40 changed files with 161 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Grid.js
Expand Up @@ -49,7 +49,7 @@ define([
// - revision: Number: The Git rev from which dojo was pulled
major: 1,
minor: 3,
patch: 5,
patch: 6,
flag: "",
toString: function(){
return this.major + "." + this.minor + "." + this.patch + this.flag; // String
Expand Down
16 changes: 16 additions & 0 deletions core/model/Model.js
Expand Up @@ -376,6 +376,22 @@ define([
return d;
},

_sizeAll: function(parentId){
var size = this.size(parentId), i, childId,
count = 0;

size = size === -1 ? 0 : size;
count += size;

for(i = 0; i < size; i++){
childId = this.indexToId(i, parentId);
console.log(childId);
count += this._sizeAll(childId);
}

return count;
},

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

Expand Down
2 changes: 1 addition & 1 deletion core/model/cache/Async.js
Expand Up @@ -139,7 +139,7 @@ define([
//Minus index range list B from index range list A,
//assuming A and B do not have overlapped ranges.
//This is a set operation
if(!rangesB.length || !rangesA.length){
if(!rangesB || !rangesB.length || !rangesA.length){
return rangesA;
}
var indexes = [], f = 0, r, res = [],
Expand Down
30 changes: 15 additions & 15 deletions modules/Body.js
Expand Up @@ -64,10 +64,10 @@ define([
// Whether to show a visual effect when mouse hovering a row.
rowHoverEffect: true,
// renderredIds: Object
// renderedIds: Object
// This object contains the current renderred rows Ids.
// For grid not using virtualVSroller, this is equal to current row ids in the grid body.
renderredIds: {},
renderedIds: {},
// stuffEmptyCell: Boolean
// Whether to stuff a cell with &nbsp; if it is empty.
stuffEmptyCell: true,
Expand Down Expand Up @@ -267,7 +267,7 @@ define([
g = t.grid,
dn = t.domNode = g.bodyNode;
t._cellCls = {};
t.renderredIds = {};
t.renderedIds = {};
if(t.arg('rowHoverEffect')){
domClass.add(dn, 'gridxBodyRowHoverEffect');
}
Expand Down Expand Up @@ -344,7 +344,7 @@ define([

autoUpdate: true,

renderredIds: {},
renderedIds: {},

compareOnSet: function(v1, v2){
return typeof v1 == 'object' && typeof v2 == 'object' ?
Expand Down Expand Up @@ -421,7 +421,7 @@ define([
domClass.toggle(t.domNode, 'gridxBodyRowHoverEffect', t.arg('rowHoverEffect'));

// cache visual ids
// t.renderredIds = {};
// t.renderedIds = {};

// domClass.add(loadingNode, 'gridxLoading');
t._showLoadingMask();
Expand Down Expand Up @@ -464,7 +464,7 @@ define([
t.onUnrender(id, 'refresh');
}
domConstruct.destroy(n);
t.renderredIds[id] = undefined;
t.renderedIds[id] = undefined;
n = tmp;
}
array.forEach(renderedRows, t.onAfterRow, t);
Expand Down Expand Up @@ -604,11 +604,11 @@ define([
// id = n.firstChild.getAttribute('rowid');
// n.removeChild(n.firstChild);
// if(g.model.isId(id)){
// t.renderredIds[id] = undefined;
// t.renderedIds[id] = undefined;
// }
// }
// reset renderredIds since all rows in body are destroyed
t.renderredIds = {};
// reset renderedIds since all rows in body are destroyed
t.renderedIds = {};
str = t._buildRows(start, count, uncachedRows, renderedRows);
n.innerHTML = str;
n.scrollTop = scrollTop;
Expand Down Expand Up @@ -638,8 +638,8 @@ define([
id = n.firstChild.getAttribute('rowid');
n.removeChild(n.firstChild);
}
//reset renderredIds since all rows in body are destroyed.
t.renderredIds = {};
//reset renderedIds since all rows in body are destroyed.
t.renderedIds = {};
en.innerHTML = emptyInfo;
en.style.zIndex = 1;
t._hideLoadingMask();
Expand All @@ -666,7 +666,7 @@ define([
t.onUnrender(id, undefined, 'post');
}
domConstruct.destroy(bn.lastChild);
t.renderredIds[id] = undefined;
t.renderedIds[id] = undefined;
}
}else{
var tp = bn.scrollTop;
Expand All @@ -681,7 +681,7 @@ define([
t.onUnrender(id , undefined, 'pre');
}
domConstruct.destroy(bn.firstChild);
t.renderredIds[id] = undefined;
t.renderedIds[id] = undefined;
}
t.renderStart += i;
bn.scrollTop = tp > 0 ? tp : 0;
Expand Down Expand Up @@ -796,7 +796,7 @@ define([
row = g.row(rowInfo.rowId, 1);
s.push('<div class="gridxRow ', i % 2 ? 'gridxRowOdd' : '',
'" role="row" visualindex="', i);
t.renderredIds[rowInfo.rowId] = 1;
t.renderedIds[rowInfo.rowId] = 1;
if(row){
t.model.keep(row.id);
s.push('" rowid="', encode(row.id),
Expand Down Expand Up @@ -839,7 +839,7 @@ define([
n.setAttribute('rowindex', rowInfo.rowIndex);
n.setAttribute('parentid', rowInfo.parentId || '');
n.innerHTML = t._buildCells(row, rowInfo.visualIndex);
t.renderredIds[row.id] = 1;
t.renderedIds[row.id] = 1;
t.onAfterRow(row);
}else{
console.error('Error in Body._buildRowContent: Row is not in cache: ' + rowInfo.rowIndex);
Expand Down
24 changes: 18 additions & 6 deletions modules/Filter.js
Expand Up @@ -357,10 +357,13 @@ define([
return d.getTime();
case 'time':
d = new Date(d);
d.setDate(1);
d.setMonth(0);
d.setFullYear(2000);
return d.getTime();
if(!isNaN(d.getTime())){ //d is not invalid date
d.setDate(1);
d.setMonth(0);
d.setFullYear(2000);
return d.getTime();
}
return null;
default: //string
return (d === null || d === undefined) ? '' : String(d);
}
Expand Down Expand Up @@ -485,13 +488,22 @@ define([

greaterEqual: function(expr1, expr2){
return wrap(function(){
return expr1.apply(0, arguments) >= expr2.apply(0, arguments);
var v1 = expr1.apply(0, arguments);
var v2 = expr2.apply(0, arguments);
return v1 !== undefined && v1 !== null &&
v2 !== undefined && v2 !== null &&
v1 >= v2;
}, "greaterEqual", [expr1, expr2]);
},

lessEqual: function(expr1, expr2){
return wrap(function(){
return expr1.apply(0, arguments) <= expr2.apply(0, arguments);
var v1 = expr1.apply(0, arguments);
var v2 = expr2.apply(0, arguments);

return v1 !== undefined && v1 !== null &&
v2 !== undefined && v2 !== null &&
v1 <= v2;
}, "lessEqual", [expr1, expr2]);
},

Expand Down
10 changes: 7 additions & 3 deletions modules/RowHeader.js
Expand Up @@ -151,6 +151,10 @@ define([
if(typeof row === 'string'){
row = this.grid.row(row, 1);
}
if(!row){
console.warn('rowHeader._onAfterRow, row is null');
return;
}
var t = this,
visualIndex = row.visualIndex(),
n = query('[visualindex="' + visualIndex + '"].gridxRowHeaderRow', t.bodyNode)[0],
Expand All @@ -167,7 +171,7 @@ define([
},

_onAfterCell: function(cell){
//This is to ensure the rowHeader get correct height for editable cells
//This is to ensuregit the rowHeader get correct height for editable cells
var t = this,
visualIndex = cell.row.visualIndex(),
n = query('[visualindex="' + visualIndex + '"].gridxRowHeaderRow', t.bodyNode)[0],
Expand All @@ -188,7 +192,7 @@ define([
function getHeight(){
return has('ie') <= 8 || t._isCollapse ? bodyNode.offsetHeight + 'px' : domStyle.getComputedStyle(bodyNode).height;
}
// setTimeout(function(){
setTimeout(function(){
h = getHeight();
if((h + '').indexOf('.') >= 0){
rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = bodyNode.style.height = bodyNode.clientHeight + 1 + 'px';
Expand All @@ -199,7 +203,7 @@ define([
// if(rowHeaderNode && rowHeaderNode.firstChild){
// rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = getHeight();
// }
// }, 0);
}, 0);
},

_onRendered: function(start, count){
Expand Down
21 changes: 21 additions & 0 deletions modules/Tree.js
Expand Up @@ -440,6 +440,27 @@ define([
return d;
},

loadChildRecursive: function(id){
var d = new Deferred(),
t = this,
m = t.model;

var i, dl = [], size = m.size(id);
// console.log(context.size);
m.when({start: 0, count: 1, parentId: id}, function(){
size = m.size(id);
for(i = 0; i < size; ++i){
var childId = m.indexToId(i, id);
dl.push(t.loadChildRecursive(childId));
}
}).then(function(){
new DeferredList(dl).then(function(){
d.callback();
});
});
return d;
},

collapseRecursive: function(id, skipUpdateBody){
var d = new Deferred(),
success = lang.hitch(d, d.callback),
Expand Down
2 changes: 1 addition & 1 deletion modules/extendedSelect/Row.js
Expand Up @@ -356,7 +356,7 @@ define([
},

_onMark: function(id, toMark, oldState, type){
if(type == 'select' && this.grid.body.renderredIds[id]){
if(type == 'select' && this.grid.body.renderedIds[id]){
// if(type == 'select'){
var nodes = query('[rowid="' + this.grid._escapeId(id) + '"]', this.grid.mainNode);
if(nodes.length){
Expand Down
14 changes: 8 additions & 6 deletions modules/filter/FilterBar.js
Expand Up @@ -661,12 +661,14 @@ define([
if(s instanceof Date){return s;}

var pattern = /(\d\d?):(\d\d?):(\d\d?)/;
pattern.test(s);
var d = new Date();
d.setHours(parseInt(RegExp.$1));
d.setMinutes(parseInt(RegExp.$2));
d.setSeconds(parseInt(RegExp.$3));
return d;
if(pattern.test(s)){
var d = new Date();
d.setHours(parseInt(RegExp.$1));
d.setMinutes(parseInt(RegExp.$2));
d.setSeconds(parseInt(RegExp.$3));
return d;
}
return 'invalid time';
},
_stringToDatetime: function(s){
if(s instanceof Date){return s;}
Expand Down
11 changes: 6 additions & 5 deletions modules/filter/FilterPane.js
Expand Up @@ -350,6 +350,9 @@ define([
interval = this.sltDateInterval.get('value');

switch(interval){
case 'hour':
past.setHours(cur.getHours() - val);
break;
case 'day':
past.setDate(cur.getDate() - val);
break;
Expand Down Expand Up @@ -388,6 +391,9 @@ define([
interval = this.sltDatetimeInterval.get('value');

switch(interval){
case 'hour':
past.setHours(cur.getHours() - val);
break;
case 'day':
past.setDate(cur.getDate() - val);
break;
Expand Down Expand Up @@ -415,11 +421,6 @@ define([
},

_setValue: function(value){
console.log('in set value');
console.log(value);
console.log(typeof value);
console.log(value instanceof Date);

if(!this._isValidValue(value)){return;}
var type = this._getType(),
combo = this._needComboBox(), tempDate;
Expand Down
2 changes: 1 addition & 1 deletion nls/el/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'Φίλτρο',
clearButtonTitle: 'Εκκαθάριση φίλτρου',
buildFilterMenuLabel: 'Δημιουργία φίλτρου&hellip;',
buildFilterMenuLabel: 'Δημιουργία φίλτρου...',
apply: 'Εφαρμογή φίλτρου',

//Sort
Expand Down
2 changes: 1 addition & 1 deletion nls/es/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'Filtrar',
clearButtonTitle: 'Borrar filtro',
buildFilterMenuLabel: 'Crear filtro&hellip;',
buildFilterMenuLabel: 'Crear filtro...',
apply: 'Aplicar filtro',

//Sort
Expand Down
2 changes: 1 addition & 1 deletion nls/fi/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'Suodatin',
clearButtonTitle: 'Tyhjennä suodatin',
buildFilterMenuLabel: 'Muodosta suodatin&hellip;',
buildFilterMenuLabel: 'Muodosta suodatin...',
apply: 'Käytä suodatinta',

//Sort
Expand Down
2 changes: 1 addition & 1 deletion nls/fr/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'Filtre',
clearButtonTitle: 'Effacer le filtre',
buildFilterMenuLabel: 'Générer le filtre&hellip;',
buildFilterMenuLabel: 'Générer le filtre...',
apply: 'Appliquer le filtre',

//Sort
Expand Down
7 changes: 6 additions & 1 deletion nls/gridx.js
Expand Up @@ -10,6 +10,11 @@ define({root:
loadPreviousLoading: "Loading...",

//FilterBar
"day": "days",
"month": "months",
"year": "years",
"hour": "hours",

"clearFilterDialogTitle": "Clear Filter",
"filterDefDialogTitle": "Filter",
"defaultRuleTitle": "Rule",
Expand Down Expand Up @@ -168,7 +173,7 @@ define({root:
//QuickFilter
filterLabel: 'Filter',
clearButtonTitle: 'Clear Filter',
buildFilterMenuLabel: 'Build Filter&hellip;',
buildFilterMenuLabel: 'Build Filter...',
apply: 'Apply Filter',

//Sort
Expand Down
2 changes: 1 addition & 1 deletion nls/he/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'סינון',
clearButtonTitle: 'ניקוי מסנן',
buildFilterMenuLabel: 'בניית מסנן&hellip;‏',
buildFilterMenuLabel: 'בניית מסנן...‏',
apply: 'החלת מסנן',

//Sort
Expand Down
2 changes: 1 addition & 1 deletion nls/hr/gridx.js
Expand Up @@ -147,7 +147,7 @@ define({
//QuickFilter
filterLabel: 'Filter',
clearButtonTitle: 'Isprazni filter',
buildFilterMenuLabel: 'Kreiraj filter&hellip;',
buildFilterMenuLabel: 'Kreiraj filter...',
apply: 'Primijeni filter',

//Sort
Expand Down

0 comments on commit 70536b7

Please sign in to comment.