Ticket #5812 (closed defect: duplicate)

Opened 10 months ago

Last modified 9 months ago

Tree root= problem

Reported by: guest Owned by: bill
Priority: normal Milestone: 1.1
Component: Dijit Version: 1.0
Severity: normal Keywords:
Cc:

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

  Changed 10 months ago by bill

  • status changed from new to assigned
  • owner set to bill
  • milestone set to 1.1

follow-up: ↓ 3   Changed 10 months 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?

in reply to: ↑ 2 ; follow-up: ↓ 4   Changed 10 months 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

in reply to: ↑ 3 ; follow-up: ↓ 5   Changed 10 months 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

in reply to: ↑ 4   Changed 10 months 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

follow-up: ↓ 7   Changed 9 months 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.

in reply to: ↑ 6   Changed 9 months 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

  Changed 9 months ago by bill

  • status changed from assigned to closed
  • resolution set to duplicate

Summarized this issue and refiled as #5879.

Note: See TracTickets for help on using tickets.