Opened 13 years ago
Closed 13 years ago
#5812 closed defect (duplicate)
Tree root= problem
Reported by: | guest | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
In the new last build (9/2/2008) , when defining root:0 (root id item is zero) in the Tree creation command for a single headed tree,
the if(!this.root)
code make the incorrect assumption that this.root is not defined (is false).
root id = 0 must be a legal value.
thanks
Eduardo
Change History (8)
comment:1 Changed 13 years ago by
Milestone: | → 1.1 |
---|---|
Owner: | set to bill |
Status: | new → assigned |
comment:2 follow-up: 3 Changed 13 years ago by
comment:3 follow-up: 4 Changed 13 years ago by
Replying to bill:
Hmm, for programmatic creation, I can make "0" a legal value but not 0, because it's assuming the key is a string. Maybe should change that?
In my humble opinion, yes, but I do not know if generally it will be a solution for others. What is real important if no other solution can be found like if root: is undefined or something similar, is to document clearly that the root id cannot be zero. For example I resolved it in my program defining a big number for the root (impossible value according to the program logics)
thanks Bill
Eduardo
comment:4 follow-up: 5 Changed 13 years ago by
See for example: http://www.w3schools.com/jsref/jsref_undefined.asp
I do not know if this is working, I did not even used it once, I will check it today at night.
Eduardo
comment:5 Changed 13 years ago by
I was not be able to wait so:
see this:
http://www.w3schools.com/jsref/tryit.asp filename=tryjsref_undefined
It works for FF2 and IE7 at least.
Eduardo
comment:6 follow-up: 7 Changed 13 years ago by
Sorry, I mistyped above. I meant to say that for *declarative* creation (ie, in markup), the problem is that rootId needs to be a string, so it won't work with data stores where ID is a number (0 or otherwise). Will think about solution to that problem.
comment:7 Changed 13 years ago by
Replying to bill:
Sorry, I mistyped above. I meant to say that for *declarative* creation (ie, in markup), the problem is that rootId needs to be a string, so it won't work with data stores where ID is a number (0 or otherwise). Will think about solution to that problem.
OK, thanks Bill, Close this PR. Only I think that it is necessary to specify it in the documentation that zero is not a valid root id. This inconvenience can be easily overcomed.
Eduardo
comment:8 Changed 13 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Summarized this issue and refiled as #5879.
Hmm, for programmatic creation, I can make "0" a legal value but not 0, because it's assuming the key is a string. Maybe should change that?