Treeview Node ID unicity requirements

View: New views
3 Messages — Rating Filter:   Alert me  

Treeview Node ID unicity requirements

by malutanpetronel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

1. Could I use in different places or under same node inside the same
tree the same node ID ?

myobj1 = { label: 'LABEL 1', id: "label1"} ;
  tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
myobj1 = { label: 'LABEL 1', id: "label1"} ;
  tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);

2. Should I use same labels with same ID ?

myobj1 = { label: 'LABEL 1', id: "label1"} ;
  tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
myobj1 = { label: 'LABEL 2', id: "label1"} ;
  tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);

3. Does the id of a node get into conflict with a DOM element, let's
say a div with the ame id ?

<div id="label1">Nothing to say</div>
myobj1 = { label: 'LABEL 1', id: "label1"} ;
  tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);




Re: Treeview Node ID unicity requirements

by Satyam-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No two elements in a web page can have the same id, that's by web
standards, YUI can't do anything about it.  Browsers won't have two
elements with the same ID.

If you mean to identify your nodes by whatever mechanism you want to set
up, you can add to the node definition any property not in use by the
Node object itself.  Any such property (or properties, you can have as
many as you want) will be stored in an object under the data property of
each node.  You can then use method to locate those:

http://developer.yahoo.com/yui/docs/YAHOO.widget.TreeView.html#method_getNodesByProperty

Satyam


malutanpetronel wrote:

> 1. Could I use in different places or under same node inside the same
> tree the same node ID ?
>
> myobj1 = { label: 'LABEL 1', id: "label1"} ;
>   tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
> myobj1 = { label: 'LABEL 1', id: "label1"} ;
>   tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
>
> 2. Should I use same labels with same ID ?
>
> myobj1 = { label: 'LABEL 1', id: "label1"} ;
>   tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
> myobj1 = { label: 'LABEL 2', id: "label1"} ;
>   tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
>
> 3. Does the id of a node get into conflict with a DOM element, let's
> say a div with the ame id ?
>
> <div id="label1">Nothing to say</div>
> myobj1 = { label: 'LABEL 1', id: "label1"} ;
>   tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.135 / Virus Database: 270.4.4/1532 - Release Date: 03/07/2008 8:32
>
>
>
>  

Parent Message unknown Re: Treeview Node ID unicity requirements

by malutanpetronel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Satyam

myobj1 = { label: labelNode, id: nodeID} ;

than with

tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);
or
tempNode = new YAHOO.widget.TaskNode(myobj1, root, false);

where root became a different node when I recursively read a tree,

than if I creat with myobj1 = { label: labelNode, id: nodeID} ;
using same nodeID value under different "root" in tree, than looking into DOM GENERATED PAGE I see nod 2 identical nodes created by YUI !

That make me beleive that oposite you've said, YUI do something with the id specified by me and replace them with uniques

<DIV class="ygtvitem" id="ygtv3" minmax_bound>...

so using same id under different node parents in the treeview component has no direct implications other than when we want to point to that node again maybe we should use getNodesByProperty and iterate nodes and compare fathers...




     
LightInTheBox - Buy quality products at wholesale price