PDA

View Full Version : [2.0a1][CLOSED] treenode.isLeaf() allways return false


gimler
10-10-2007, 06:29 AM
i use the tree and it works fine, but the function isLeaf() allways return false.
the property leaf return undefined or "true"(string not boolean)

Ext: 2-alpha1

greetings
Gimler

evant
10-10-2007, 07:16 AM
This is not necessarily a bug, post your code, what are you passing to the TreeNode?

randomseb
10-10-2007, 07:46 PM
I had the same problem today. turns out I was passing { "leaf": "true" } instead of "leaf":true - as soon as I took the quotes off, it declared itself as a leaf properly.. (I assume extjs takes the json literally as a string in that case, instead of a boolean value)

evant
10-10-2007, 07:59 PM
Yeah, the isLeaf check is:


return this.leaf === true


Which also matches the type. I guess it could return true for 'truthy' values, however this might be a consistency thing.