[Dojo-interest] Bug / Misfeature / Bad Doc in Tree Widget

Daniel daniel.carrera at zmsl.com
Wed Dec 12 14:28:20 UTC 2007


Anni Hienola wrote:
> Data store identifier can be anything. I don't know why in the Tree 
> example the data identifier is set to be 'name'. In my Tree, it is 
> {identifier: 'id'; ...}.

Yeah. And  identifier:'id'  is immensely better. It's very clear, it 
doesn't conflict with the uses of "name", and immediately gives most 
readers an idea of what it is.


For the purpose of documentation I would make it  identifier:'myId'. 
It's "needlessly" verbose, but it sends the message that you can pick 
whatever value you want. It just makes the example one notch better.


> The label attribute in Tree widget tells, which 
> field is used as the visible name for the tree leaf. In this case it is 
> again 'name'. Very misleading indeed.

Yeah.

> So, Tree requires (I think) label attribute to be set in its data store. 
> I'm not quite sure if Tree *requires* unique identifier for its items, 
> but I've found for other reasons it to be quite useful.

Testing revealed that *if* the names are unique, then you don't need an 
identifier. But if they are not unique, you do need it.


Cheers,
Daniel.


More information about the Dojo-interest mailing list