Opened 11 years ago

Closed 11 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 11 years ago by bill

Milestone: 1.1
Owner: set to bill
Status: newassigned

comment:2 Changed 11 years ago by 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?

comment:3 in reply to:  2 ; Changed 11 years ago by guest

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 in reply to:  3 ; Changed 11 years ago by guest

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 in reply to:  4 Changed 11 years ago by guest

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 Changed 11 years ago by 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.

comment:7 in reply to:  6 Changed 11 years ago by guest

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 11 years ago by bill

Resolution: duplicate
Status: assignedclosed

Summarized this issue and refiled as #5879.

Note: See TracTickets for help on using tickets.