Flex :: Get Item By Index In A Tree Control?

Jan 20, 2010

I'm doing a drag and drop operation on a tree using some help from Adobe's quick Starts:[URL]

The code suggested is roughly this:

var dropTarget:Tree = Tree(evt.currentTarget);
var i:int = dropTarget.calculateDropIndex(evt);
myTree.selectedIndex = i;

[Code].....

EDIT: I forgot to post that my current workaround is setting the selectedIndex = -1 after I get my node:XML. I'm afraid that if something bogs on the processor the user may see it select then deselect.

View 2 Replies


Similar Posts:


Xml :: Flex - Move Item Around In A Tree Control?

Mar 9, 2010

I have a tree control and I want to give the user the ability that he can move up and down the element he just selected with a up and a downbutton. The tree gets generated from XML. I managed to insert the selected item a second time at a other place, with the following code:

var parentXML:XML = XML(containerTree.selectedItem).parent();
var upperItem:XML = topContainer.source[containerTree.selectedIndex-1];
parentXML.insertChildBefore(upperItem,XML(containerTree.selectedItem));

but then I have the item there twice in the List. How can I remove to reinsert it?

View 1 Replies

Actionscript 3 :: Flex - Tree Control Drag Drop .item Position?

Dec 9, 2009

just facing a difficulty with tree control drag drop..Suppose i have tree with drag-drop enabled.I want to which node(id) is droped inside which node. 1]if i drag "Cat1" node inside "Cat3",i want to identify ids of siblings of "cat1",and "cat3".2]in general i want to know the ids of current element being moved along withits new parent and new position and save these postions.3] Also "cat4" when moved outside "cat3",i want know its position and its siblings id.

<mx:XML id="treeDP">
<node label="Categories">
<node label="Cat1" id="1" isBranch="true"/>

[code].....

View 2 Replies

Flex :: Access TileList Item Index In A Custom Item Renderer?

Mar 4, 2011

<mx:itemRenderer>
<mx:Component>
<mx:Canvas>

[code]......

View 2 Replies

Flex :: Knowing The Exact Index Clicked In A Tree Event?

Jul 18, 2011

i have a tree component that dispatches an itemOpen event. When the black triangle next to the yellow folder is clicked, that folder opens to expose its children.

Is there anyway to know the index of the open folder? there is a rowIndex property in the target property of the openItem event that stores the index but it is not accessible.

View 2 Replies

Flex :: How To Drop Something Into A Tree Item

Jan 15, 2010

I just read a comment at FlexExamples: One thing to note about the tree is that it is really just a list in which items are displayed. What that means is, you can't really drop somthing "into" folder unless the folder is open. Even in that case the user experience isn't quite right. So try moving everything out of one of the folders and then collapse that empty folder. If you drop something "on" the folder, it actually winds up between the target folder and the one below or above. This is indicated by the black line showing up as you move the mouse over the folders. If you "open" the folder (the only way to tell it is open is by the arrow) and then try it, you end up with an additional drop zone that is basically the bottom half of the opened, empty folder. This is also indicated by the black lines position.

It would be better if the middle section of any item could always be the drop zone for "add to this folder" and the top and bottom edges could be for dropping above or below respectively.I've just come to the same problem. Has somebody already managed this problem? In my case, I have dragMoveEnabled in the tree and offer the ability of dragging the tree items. But it is impossible to drag an item into another item that is empty. You can only drop the dragged item above or underneath an empty item.

View 4 Replies

Flex :: Use 2 Different Item Renderers In Mx:Tree?

Mar 20, 2010

How can I use multiple item renderers in mx:Tree depending on item's depth/level in tree?For example. For the first level items I want to use label with button and for second level items combobox

View 2 Replies

Flex :: Tree Component Item Rendering

Dec 4, 2009

I have created a MyTreeItemrenderer extending TreeItemrenderer.

However, I do not want any label, folder, disclosure icon nor icon. I want to dispaly every node of the tree with my own graphic like eg: a line, round image etc.,

View 1 Replies

Flex - OS Like Behavior When Edditing A Tree Item?

Jan 20, 2010

I have a Tree Control inside my Flex Application which I want to edit on a doubleclick on a tree item. I found the properties doubleClickEnabled="true", doubleClick="startEditMode()", and editable="true". With these functions I can detect a double click and I can change the editable property to true based on a double click. The problem is that after I double clicked on a Item i have to click once more to really enter the edit mode. That doesn't seem to be intuitive at all

[Code]...

View 1 Replies

Flex :: Get The XML Parent Of A Selected Tree Item?

Jan 27, 2010

I have a XML based Tree Control. The XML Structure is recursive, so the children's can have the same Element as the parent. I now want to let the user add and remove the elements. Do do so I need to get the parent element of the selected Item. Following code I already collected together:

var selected:XML = treeControl.selectedItem;
parent.insertChildAfter(selected:XML, newElement);

I just don't know how to get to the selected parents node as there is no such method like treeControl.selectedItem.parent.

View 1 Replies

Flex :: Access All Item Renderer Of MX: Tree In?

Jul 20, 2010

my renderer contains a canvas in it, i add some title-window, every time i see my tree previously added Title-Windows are visible, i want to access each n every item in tree and remove previosly added all windows from the rendere. how access all the item renderer in AS3 ?

View 1 Replies

Actionscript :: Pop Up In Flex Tree Item Renderer?

May 9, 2011

I have an mx:tree with with TreeItemRenderer as below.

Parent1 (Delete | Rename)
Child1
Child2
Parent2 (Delete | Rename)
Child3
Child4

Delete and Rename are link buttons

Now when i click Rename a popUp should be shown like

OldName : Parent1(Text Input showning present Name)
Enter New Name: Parent1NewName(Text Input for entering New name)
OK | CANCEL Buttons

Afetr Entering the new name,click OK,popup should be closed and need to get the value in the treeItemRenderer.

I have the logic to rename the Parent1 in TreeItemRenderer and also I m able to get the Parent1 in the popup OldName TextInput.But after entering the new name i m not able to get that new name in the TreeItemRenderer.

View 1 Replies

Flex :: Itemrenderer - Referencing And Setting A Single Item Renderer Instance In A Flex Tree At Runtime?

Oct 17, 2010

Anyone know how to change a single instance of an item renderer for a Flex tree item at runtime? To reiterate, I'm not trying to change the entire tree's item renderer like this:tree.itemRenderer = new ClassFactory(ItemRenderer2);I'm trying to change the item renderer of a single tree item like this (the following code does not work):tree.selectedItem.itemRenderer = new ClassFactory(ItemRenderer2);To put it more simply, does anyone know how to reference an instance of an item renderer and set it to a new item renderer class? I've tried using the Tree's itemToItemRenderer() method with no success.

View 1 Replies

Flex :: Get Item From AdvancedDataGrid Given Index

Jul 7, 2009

I've got a subclass of AdvancedDataGrid showing a tree-like data structure. How can I, given the index returned by calculateDropIndex, get the item at that index? After reading through reams of code, it seems like the least terrible way is:

var oldSelectedIndex:int = this.selectedIndex;
var mouseOverIndex:int = this.calculateDropIndex(event);
this.selectedItem = mouseOverIndex;
var item:* = this.selectedItem;
this.selectedIndex = oldSelectedIndex;

The other option seems to be tinkering around with the iterator property... But, judging by the way I've seen it used, that will get pretty harry pretty quickly too. So, how can I get the item at a particular index in an advanced datagrid without going insane?

View 3 Replies

Flex :: Prevent Tree From Reusing Item-rendrer?

May 2, 2011

i was in situation that tree is re-using my custom item-renderer.. is there any method or way around we can stop tree to reuse.. and always create a new item-renderer for new item..

View 1 Replies

Flex :: Tree Custom Item Renderer Children Creation?

Oct 14, 2010

I have created a custom item renderer for the tree, i have added some children in create children function, my problem is that sometimes i need to show these children and sometimes i don't, depending on clicking on a button which also i have added at create children, the problem is that i had to create the item even if i don't want it to be visible, and removed it by making visible false, and this costs a lot of memory, i have tried to create it at buttons click listener but when scrolling the child disappears, and it may appear again if i keep scrolling up and down.. i am trying to add the child just when i need it to be visible, is this possible or i have to create it on child creation method?

View 1 Replies

Flex :: Selected Item In A Tree Is Not Highlighted After Dragging And Dropping It?

Jul 24, 2011

I have a Flex (3.5) Tree with drag & drop support, but the problem is that after I drag an item (node) and drop it, it's supposed to be the selected item in the tree, but for some reason it's not highlighted.

View 1 Replies

Flex :: Get The Item Parent In A Tree When Using Nested Objects As Data Provider?

Jan 11, 2010

I have a Flex tree with an ArrayCollection as data provider. The collection holds an array of CategoryVO objects. Each object can have another array of CategoryVO objects inside it's "child" attribute. This way the tree displays the data correctly. Now I want to get the parent of a specific item, e.g. tree.selectedItem. Using XML as data provider the item parent is avaiable thorugh the parent() method. But I can't convert my data to XML. How can I get an item's parent? Perphaps using the tree's dataDescriptor?

View 2 Replies

Flex :: Prevent The Addition Of Dragged Item In Tree Which Drag Accepting?

Oct 25, 2010

i have two tree one tree lets say TreeDrag is drag enabled and other is drop enabled lets say TreeDrop.. when i drag item from TreeDrag to TreeDrop,, i want to show feedback and everything else normal except the addition of dragged item in TreeDrop..

View 1 Replies

Flex :: Repeater Item As An Array Index (binding)?

Oct 12, 2010

I have a label inside a repeater (rptInfos), and I have an arraycollection (Texts) that has the translations. The "Texts" content is changing when I change the language, and normally I use {Texts.getItemAt(219}} for example when I need a translated text. But in the repeater I have a translateable column, so I want to use it like this:

<s:Label text="{Texts.getItemAt(rptInfos.currentItem.DictID as int)}" />

but it says "Syntax error: expected a definition keyword (such as function) after attribute , not target".I wanted to translate it in the labels creationComplete event, but than I can forget about binding, so only when reloaded can I have the content to update.

View 2 Replies

Actionscript 3 :: Find The Index Of A Dropped Item In Flex?

Jul 14, 2011

How can I find the index of a item dropped into a list in flex using a spark list?

View 2 Replies

Flex :: Override Child Node Controls In A Flex Tree Control?

Aug 20, 2010

I am currently developing a dynamic LineChart in FLEX 4.I am implementing a Tree control next to my LineChart, which will filter the LineChart dataprovider and lineseries. The tree control has several branches and ultimately 5 children (leaf nodes) at the bottom of the last branch.I need the leaf node/children to be displayed as checkboxes inside the tree control.As I understand,this will require overrides in the TreeItemRenderer class.This is where I am a little confused on how to implement that.Currently I can distinguish between leaf and branches using this code, in my main MXML component.I added this because it may be helpful to some beginning FLEXdevelopers, such as myself, who cannot easily find this functionality documented well:

private function treeClick(e:ListEvent):void {
_selectedItem = Tree(e.currentTarget).selectedItem;
if(mainTree.dataDescriptor.isBranch(_selectedItem)) {[code].....

I am looking at the TreeItemRenderer override class from the following example here: In the example, they override the "createChildden" super function to add checkboxes to the tree control.My question is, can I override the createChildren function directly in my MXML component, and not have to use an entire class file to override this functionality? Must I re-invent the wheel to do this?Also, how can I distinguish that my treeItem is a leaf node and not a parent, in the override function? I only want to add checkboxes to the leaf nodes, how can I differentiate? The following example adds checkboxes to all branches and leaf nodes, but I want to add checkboxes only to leaf node/children. How would you approach that?

override protected function createChildren( ): void
{
super.createChildren( );[code]............

Here is my tree tag:

<mx:Tree id="mainTree" dataProvider="{treeData}" itemRenderer="TreeCheckBoxItemRenderer" labelField="@label" showRoot="false" width="100%" height="100%" itemClick="treeClick(event)" />

View 1 Replies

Xml - Flex Tree Control With Array Collection?

Apr 9, 2012

Im trying to populate a tree control with an external xml file brought in via arraycollection but i need to group the xml data to display in the tree Okay my external xml file is called parts.xml and it looks like this:

[Code]...

additionally what i intend is for the user to have huge tree of parts and they select a node at the partnumber level and drag an drop it on to a datagrid where all the other tags of the part gets displayed.

Ive tried and tried many things without any luck. even now im thinking maybe if i looped through the array-collection and created a new array just for the tree to get it to display the way i need it, then when the user dragged and drop a part onto the grid i would have code that would look for that part number in the original arraycollection and add it to a new array just for the datagrid... i still dont know how i would create that new array for the tree!! cause the xml data is grouped by partgroup and then grouped again by parttype before you get the individual part numbers

View 1 Replies

Flex :: Tree Control Get The ItemEditorInstance Of A Just Added Xml Node?

Jan 27, 2010

I have a Tree Control on which I let user add some nodes. When a node gets added I want to let the user edit the added control right away. How do I get the itemEditorInstance of a just added xml node?

View 1 Replies

Flex :: Different Vertical Gaps Between Siblings In The Same Mx:Tree Control?

Jul 14, 2010

Does anyone know of a way to specify different vertical gaps between siblings in a Tree? I want to child nodes spaced tighter together (maybe 10px) while the top level parents remain spaced further apart (20px). Essentially, I need to change the gap dynamically based upon the depth of the node, but I'm not sure if the Tree class (or the List class, which Tree extends) offers this type of functionality.

View 2 Replies

Flex :: Expand And Collapse Icon In Tree Control?

Aug 8, 2010

I am having some trouble with the flex Tree control.I have a control in my system and of course it is data driven.I have a group which shows a folder icon and that's fine but it also shows an expand icon when the item has no children.I don't what it to show the expand icon when the group has no children but I do want to show the folder icon, because it is different entities in my system.

View 1 Replies

Flex :: Tree Control Only Displaying Branch And Not Leaf Elements

Sep 24, 2010

I've created an mxml page that displays a tree control, however the data is only being displayed as branches. Even items that are leaves are being displayed as branches.
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
public function init():void {
var item:Object;
var array:Array = new Array();
[Code] .....

View 1 Replies

Flex :: Delete Item From Collection Bound To Datagrid And Update The Grid Selected Index

Feb 20, 2011

I have a datagrid with an xmlListCollection bound to it:

<mx:DataGrid id="dgCompetente" includeIn="Competente" x="10" y="66" width="547" height="468"
change="dgCompetente_changeHandler(event)" dataProvider="{colCompetente}"
editable="false">

[Code]......

I want the selectedIndex to remain the same. So, if I delete item 2, the next in the list should be selected. The problem is that if I delete item 2, item 3 will be selected and I have no idea why.

View 1 Replies

Show Item Index In My Item Renderer?

Mar 10, 2011

How to show the item index in my item renderer.Owner of the item renderer is TileList. [url],..

View 2 Replies

Flex :: Change The Appearance Of Nodes In A Tree Control Using An Extended TreeItemRenderer?

Nov 4, 2009

I'm using a tree control that I want to customize. The data items in the tree's dataProvider have a property name that should be used for labeling the node, and a property type that should be used to select one of several embedded images for use as an icon. The simplest way to do this is by using the labelField and iconFunction properties.

However, I wanted to get started with item renderers and open the door for adding more complex customization later, so I tried making my own item renderer. I extended the TreeItemRenderer class as follows and used it in my tree control:

class DirectoryItemRenderer extends TreeItemRenderer
{
[Embed("assets/directory/DefaultIcon.png")]
private static var _DEFAULT_ICON:Class;

[Code]....

This code has no effect whatsoever, icon and label in the tree control remain at their defaults. Using trace(), I verified that my code is actually executed.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved