Permalink
Browse files

explicitly cast before adding -- if options.query.level is a string c…

…oercion will bite and the isNaN check won't help you if it's also a valid number, a classic jswtf: e.g. `s = "3"; s += 1; // "31"; isNaN(s) // false`
  • Loading branch information...
deanlandolt committed Sep 16, 2011
1 parent 8a8ea08 commit b55157f583e71886323da4eb08e6cb022ac9656e
Showing with 1 addition and 1 deletion.
  1. +1 −1 Tree.js
View
@@ -11,7 +11,7 @@ return function(column){
column.renderCell = function(object, value, td, options){
// summary:
// Renders a cell that can be expanded, creating more rows
- var level = options.query.level + 1;
+ var level = Number(options.query.level) + 1;
level = isNaN(level) ? 0 : level;
var grid = this.grid;
var mayHaveChildren = !grid.store.mayHaveChildren || grid.store.mayHaveChildren(object);

0 comments on commit b55157f

Please sign in to comment.