SelectedItems must be an array.

If you have:

Var xml:XML = <node name="Node 1" id="1">
<node name="Node 1.1" id="2" />
 <node name="Node 1.2" id="3">
 <node name="Node 1.2.1" id="4" />
 <node name="Node 1.2.2" id="5" />
 </node>
</node>
Var selectedIds:Array = [2, 4, 5];

Then you need something like:

Var selItems:Array = new Array();
For (var i:int = 0; I < n; i+++
{
    var id:String = selectedIds[i].toString();
    var node:XML = xml..node(@id == id)[0];
    selItems.push(node);
}

Then assign selItems to the selectedItems.


On 8/5/11 1:12 AM, "steveroger_flex" <steveroger_f...@yahoo.com> wrote:






Thanks alex for reply..
but actually I do not getting how it implemented.

Can you please provide me any similar kind of example?
Is it possible using XMLList?

Steve

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , Alex 
Harui <aharui@...> wrote:
>
> You will have to make a new array of the nodes you want selected.
>
>
> On 8/4/11 9:45 PM, "steveroger_flex" <steveroger_flex@...> wrote:
>
>
>
>
>
>
> I am having list of nodes in array.
> My problem is how should I use seletedItems with list of node id array.?
>
> Data provider of tree component.
>
> <node name="Node 1" id="1">
>  <node name="Node 1.1" id="2" />
>  <node name="Node 1.2" id="3">
>  <node name="Node 1.2.1" id="4" />
>  <node name="Node 1.2.2" id="5" />
>  </node>
> </node>
>
> Node id Array=(2,4,5).
> I wanna select Node 1.1, Node 1.2.1 & Node 1.2.2 by clicking on button.
>
> tree.selectedItems = array;
> is not working.
>
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>  
> <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aharui@> wrote:
> >
> > Use selectedItems
> >
> >
> > On 8/4/11 5:08 AM, "steveroger_flex" <steveroger_flex@> wrote:
> >
> >
> >
> >
> >
> >
> > Hello Friends,
> >
> > I am facing a problem and can't getting any idea to solve this.
> > Problem is, I wanna select one or more tree nodes using actionscript.
> > I have set allowMultipleSelection="true" property of tree component.
> >
> > I succeed in selecting one node. But can't in multiple.
> > I had used tree.selectedItem for single node.
> >
> > any idea to solve this?
> >
> > Thanks,
> >
> > Steve.
> >
> >
> >
> >
> >
> >
> > --
> > Alex Harui
> > Flex SDK Team
> > Adobe System, Inc.
> > http://blogs.adobe.com/aharui
> >
>
>
>
>
>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to