Skip to content

Commit

Permalink
change 'isArray' to 'isArrayLike' in dojox/grid/_Layout::setStructure…
Browse files Browse the repository at this point in the history
… to handle layout structures that are defined via a query that passes in a NodeList (this happens when creating a grid from markup)
  • Loading branch information
vansimke committed Aug 12, 2016
1 parent 082aa52 commit 74dad0b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions grid/_Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ return declare("dojox.grid._Layout", null, {
}
}
}

//Fix #9481 - reset idx in cell markup
array.forEach(this.cells, function(c){
var marks = c.markup[2].split(" ");
Expand All @@ -84,7 +84,7 @@ return declare("dojox.grid._Layout", null, {
c.markup[2] = marks.join(" ");
}
});

this.grid.setupHeaderMenu();
//this.grid.renderOnIdle();
},
Expand All @@ -103,7 +103,7 @@ return declare("dojox.grid._Layout", null, {
return false;
}
},

addCellDef: function(inRowIndex, inCellIndex, inDef){
var self = this;
var getCellWidth = function(inDef){
Expand Down Expand Up @@ -142,7 +142,7 @@ return declare("dojox.grid._Layout", null, {
props.unitWidth = getCellWidth(inDef);
return new cell_type(lang.mixin({}, this._defaultCellProps, inDef, props));
},

addRowDef: function(inRowIndex, inDef){
var result = [];
var relSum = 0, pctSum = 0, doRel = true;
Expand Down Expand Up @@ -174,7 +174,7 @@ return declare("dojox.grid._Layout", null, {
});
}
return result;

},

addRowsDef: function(inDef){
Expand All @@ -190,15 +190,15 @@ return declare("dojox.grid._Layout", null, {
}
return result;
},

addViewDef: function(inDef){
this._defaultCellProps = inDef.defaultCell || {};
if(inDef.width && inDef.width == "auto"){
delete inDef.width;
}
return lang.mixin({}, inDef, {cells: this.addRowsDef(inDef.rows || inDef.cells)});
},

setStructure: function(inStructure){
this.fieldIndex = 0;
this.cells = [];
Expand Down Expand Up @@ -244,7 +244,7 @@ return declare("dojox.grid._Layout", null, {
("cells" in def || "rows" in def || ("type" in def && !isCell(def))));
};

if(lang.isArray(inStructure)){
if(lang.isArrayLike(inStructure)){
var hasViews = false;
for(var i=0, st; (st=inStructure[i]); i++){
if(isView(st)){
Expand Down

2 comments on commit 74dad0b

@charles-dexter-ward
Copy link

@charles-dexter-ward charles-dexter-ward commented on 74dad0b Nov 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems even dojox/grid/_Layout.js::setStructure needs to be patched.
At row 233:

		var isRowDef = function(def){
			if(lang.isArray(def)){
				if(lang.isArray(def[0]) || isCell(def[0])){
					return true;
				}
			}
			return false;
		};

should be modified to:

		var isRowDef = function(def){
			if(lang.isArray(def)){
				if(lang.isArrayLike(def[0]) || isCell(def[0])){
					return true;
				}
			}
			return false;
		};

At row 247:

if(lang.isArray(inStructure)){

should be modified to:

if(lang.isArrayLike(inStructure)){

@vansimke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing this! After reviewing the PR that you submitted (#237), I realized that you were addressing a similar, but unique issue compared to PR #238. I've landed #237 in master and backported to 1.11.

Please sign in to comment.