Tree control and XML dataprovider

Hi,
I am trying to get this xml ( http://mitjafelicijan.net/test.xml ) working with my tree control in my Flex app and cannot figure it out how exactly to do this.
my Flex code is this
<mx:Tree left="0" top="0" bottom="0" showRoot="true" id="trvTreeview" right="0"></mx:Tree>
and my AS code is this
var tmp:XML = XML(event.target.data);
trvTreeview.dataProvider = tmp.node;
I get such output
http://mitjafelicijan.net/tree.png

The default data descriptor will see any child node as a child and claim that node is a folder.  If the xml node used attributes like this:
Then there aren't any child nodes.  However, if you can't change the XML structure you can create a custom TreeDataDescriptor that is smarter about hasChildren()
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui

Similar Messages

  • Tree control and XML

    Hi,
    I have an XML file. I want to display the nodes from the XML
    using a tree control.
    The structure of the XML is
    <grandparent>
    <parent>
    <child1> 1 </child1>
    <child2> 2 </child2>
    <child3> 3 </child3>
    </parent>
    <parent>
    <child1> 4 </child1>
    <child2> 5 </child2>
    <child3> 6 </child3>
    </parent>
    <parent>
    <child1> 7 </child1>
    <child2> 8 </child2>
    <child3> 9 </child3>
    </parent>
    </grandparent>
    Can I display the tree like
    grandparent
    parent
    1
    4
    7
    skipping some children.

    Two choices:
    1. pre-process the xml into a form the tree can render
    directly.
    2. Create a custom Tree Data Descriptor
    Tracy

  • List Control and XML data

    I am trying to display XML data from a HTTPReqeust in a list
    control. Here's my mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="aircrafts.send()">
    <mx:Script>
    <![CDATA[
    import mx.collections.XMLListCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var aircraftDp:XMLList;
    private function aircraftXMLHandler(event:ResultEvent):void
    aircraftDp = event.result.aircraft;
    ]]>
    </mx:Script>
    <mx:HTTPService id="aircrafts"
    url="
    http://localhost:8080/flysafe/aircrafts"
    result="aircraftXMLHandler(event)"
    resultFormat="e4x"/>
    <mx:List x="10" y="53"
    dataProvider="{aircraftDp}"></mx:List>
    </mx:Application>
    The REST service returns the following XML document:
    <aircrafts>
    <aircraft id='0' label='Cessna' href='
    http://localhost:8080/flysafe/aircrafts/0'/>
    <aircraft id='1' label='Piper' href='
    http://localhost:8080/flysafe/aircrafts/1'/>
    </aircrafts>
    The List control is empty. I cannot figure out how to get the
    right connection between the data provider and the xml returned by
    the HTTPRequest.

    I figured it out. The data provider was set up correctly, but
    I wasn't telling the listbox what to use for the label. Adding the
    following attribute to the listbox fixed the problem.
    labelField="@id"

  • Jdeveloper Data Source control and xml file

    Hi
    I was wundering if Jdeveloper can parse a xml file and and show the results in a grid for a xml file just like the webservice control.
    like here
    http://www.oracle.com/technology/obe/obe11jdev/11/wsdc/wsdc.htm
    regards

    If I'm understanding what you are aiming for then the URL Data Control can do this for XML files if you provide the XML Schema for them.
    See this sample:
    http://www.oracle.com/technology/products/jdev/howtos/urldatacontrol/urldatacontrol.html

  • Tree control with xml last node!

    The question is how to view the tree lastleaf as last
    nodename + nodevalue in an xmlobject?
    <node1>
    <node1a>10
    </node1a>
    </node1>
    <node2>
    <node2a>
    <node2b>20
    </node2b>
    </node2a>
    </node2>
    I want the tree structure like:
    Node1 (folder icon)
    Node1a = 10 (doc icon)
    Node2
    Node2a
    Node2b = 20 (doc icon)
    In Flex the tree views:
    Node1 (folder icon)
    Node1a (folder icon)
    10 (doc icon)
    Node2
    Node2a
    Node2b (folder icon)
    20 (doc icon)
    in my app I get a result from a webservice that returns some
    nodes that can have one or more values. Say Node1a can have 10, 34,
    43, so in the tree leaf I it should view Node1a = 10, 34, 43.
    Any suggestions?

    The problem is when the value is between xml tags (
    <node>value</node>) the node name gets folder icon and
    value gets doc. icon.
    With lot of last elements, one has to click every node to see
    the values.
    With labelFunction every leaf gets null value:
    If hasComplex return localname
    Else
    Return localname + children
    When I try to pars xml to new one, hasChildren returns true
    for las element, and if there is no value the node shows null.
    Then walking the xml recursively how do I insert the nodes in
    new xml with the same structure but tags like (<node
    data=”value” />)? (to XMLListCollection)
    Hope it’s clearer

  • Tree control and drop target data

    Hi
    I can't seem to find an answer to my problem anywhere.
    Is it possible to read the data from the node over which an
    item is dragged and accept or reject a drop if for example the node
    data has attribute droppable?
    Attached is the ArrayCollection used to store dummy data.
    I would like to allow dragging elements to Private folder and
    disallow dragging them to Public folder.
    Thanks for any help.

    Yes. Do the logic in the dragOver and dragDrop handlers.
    Tracy

  • Tree Control  and context menu

    Hello,
    I created a tree with a menu. But the menu is not displayed on right click of a node .... Well I can miss something...
    Anybody have an idea for help me ?
    Best regards

    Hi Aurélien,
    This feature is not yet supported. Nonetheless, starting with SP13 you will be able to connect context menus to any ui element in the same way as it is the case in 7.10 with the limitation that context menu inheritance between ui elements along the ui element hierarchy not supported in SP13.
    Best regards,
    Thomas

  • CVI Tree Control and Line Break

    Hi
    Is there a way in  CVI Treecontrol to do a line break if the column is to short ?
    Regards
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

    Hi jared,
    If the text is to long there should be a line break
    Regards
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
    Attachments:
    shoot.jpg ‏27 KB

  • AS 3.0 & WebService & Tree control Bind to hierarchical data?

    What is the trick to get the results of a call to a
    webservice that returns a hierarchical XML SOAP document to map
    directly to a Tree Control's dataProvider property?
    In the debugger, I can see that lastResult is an ObjectProxy
    which has a couple of properties and one of them is an
    ArrayCollection as I expect. However, I can't figure out how to use
    this result with a Tree control and the dataProvider property so
    that I can navigate thru the hierarchy returned.
    TIA
    George

    Yeah this is using the embedded scripting. I need to change this to show the final sql vs. the script that is being used.
    -kris

  • How to binding incoming xml node list to the tree control as dataProvider

    Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
    Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
    Please see the presudo-code here:
    1.  Model layer(CsModel.as)
    public class CsModel
            [Bindable]
            public var treeXML:XML=<nodes><car label="virtualOne" id="1">
                                   </car></nodes>;
            (Here, I want to build binding relationship on the <car/> node,
             one 'virtual/stub' node is set here with lable="virtualOne".
             But this node will be deleted after IdTree
             control is created completely.)      
            [Bindable]
            public var treeData:XMLList =new XMLListCollection(treeXML.car);
    2. view layer(treePage.mxml)
            private var _model:CsModel = new CsModel();
            private function addNode():void
                    var newNode:XML=<car/>;
                    newNode.@label="newOne";
                    newNode.@id=1;
                    _model.treeXML.appendChild(newNode);
                             private function cleanData():void
                                     delete _model.treeXML.car;
            <mx:VBox height="100%" width="100%">
            <mx:Button label="AddNode" click="addNode()" />
            <mx:Tree id="IdTree"  labelField="@label"
              creationComplete="cleanData()"
              dataProvider="{_model}"/>
        </mx:VBox>
    3. Top view layer (App.Mxml)
    <mx:application>
        <treePage />
    </mx:application>
    For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
    So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?

    If u want to display the name : value then u can do like this
    <xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

  • Flex tree displaying raw XML with tags

    For some reason, after I setup a tree control and set its
    dataprovider to an XML that a coldfusion component is returning,
    the tree will display the raw XML in one node (including tags and
    everything) instead of formatting it into folders and files. At
    first I thought the coldfusion component was formatting the XML
    incorrectly but after I used one of the example XML's in the adobe
    docs, it will still display the RAW xml. This is the code where I
    define the tree control:
    <mx:Tree x="0" y="10" width="266" height="223"
    id="courseTree" dataProvider="{myxml}"/>
    and even using this example XML from the livedocs it still
    doesnt format it and display folders and entries, it will display
    the raw XML with tags:
    <mx:XML id="myxml">
    <Company label="Macromedia">
    <Branch label="Newton">
    <Department label="Flex Doc">
    <Title label="Intern">
    <Name label="Kapil Virdi"></Name>
    </Title>
    </Department>
    </Branch>
    </Company>
    </mx:XML>

    I also tried the following format for the XML as the
    datasource, and it still only displays the raw XML and not format
    it into folders
    <node>
    <node label="Finance" dept="200">
    <node label="John H" />
    <node label="Sam K" />
    </node>
    <node label="Engineering" dept="300">
    <node label="Erin M" />
    <node label="Ann B" />
    </node>
    <node label="Operations" dept="400" isBranch="true" />
    </node>

  • How to render image in tree control without embed it

    Hello frndz i am working on tree control and want to show imagein its node through xml list collection.i have searched a lot for this but in every example with tree control images are embeded.i dont want to hardcode the image.Need to make the image comes from database(Xml).so is there any live or demo example for tree control.
    Thanks in Advance
       Vineet osho

    if you decompile the imaging.ear file, there is a web.xml file which you can add the following parameter:
    <context-param>
    <param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
    <param-value>never</param-value>
    </context-param>
    or take a look at      Receiving "Warning: Unable to load content in a frame. Frame content will load at the top level." When Trying to Use the <af:inlineFrame> Component [ID 1266770.1] on Oracle Support.
    Make sure you take a copy of the imaging app before you make changes. You can then upload back through the weblogic console.
    Sudi

  • How can I save the all the values of a tree control ?

    I have a problem, in run time, I adds new items on a tree control, but i don´t know how I can save the values of the child text of each item in a file.
    Thanks.

    I'm no expert on the tree control, but I made a small example to save all items to a textfile, including item tag, item string, and indent level. One drawback of this method is that it fully expands the tree regardless how the user left it. To go the other direction, you'd have to write a routine to go through the text file and programmatically build the tree.
    To master the tree control, I think you have to resort to creating a control reference for it and using the Invoke Node to do some operations. For another approach to traversing and operating on a tree, check out the "Traversing Tree Controls and Setting Custom Symbols" (search the NI Developer Zone site).
    Best of luck,
    John
    Attachments:
    Save Tree Structure to Textfile.vi ‏32 KB

  • Please, I need help in this,How to make a tree control appear from right to left ??

    i working on Arabic project in which we use a tree control and i  want it to display its branches from right to left .
    i tried to rotate it but it doesn't work because the disclosure triangle still appear on the left .
    i ask if there is any thing to mirror the tree control ,and ask if this mirroing will work or not?

    You'll need to modify the layout logic of your renderer.
    Here's a simple example that extends the default tree renderer and overrides the updateDisplayList method(). It will probably need more work. Set textAlign="right" on your Tree control when you use this renderer. You'll also need to supply a disclosure icon that points in the opposite direction.
    package
        import mx.controls.treeClasses.TreeItemRenderer;
        import mx.controls.treeClasses.TreeListData;
        public class RightToLeftTreeItemRenderer extends TreeItemRenderer
            override protected function updateDisplayList(unscaledWidth:Number,
                                                      unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                var startx : Number = data ? TreeListData( listData ).indent : 0;
                startx = unscaledWidth - startx;
                if ( disclosureIcon )
                    disclosureIcon.x = startx - disclosureIcon.width;
                    startx = disclosureIcon.x;
                if ( icon )
                    icon.x = startx - icon.width;
                if ( label )
                    label.x = 0;

  • Tree control tip strip for each item

    In tree control is possible set a Tip strip for each item (node) of tree?
    In tree control  tipStrip property seems relative to all tree.
    Thanks all.

    The only thing I can think of is to use an event structure
    use a mouse move event
    Get Cords
    Calculate what item the mouse is over
    Use a Tips property node to write the correct string.
    The hard part will be calculating what item the mouse is over, The Displayed Items property node should help.
    I am actively working on a program that is centered around a tree control and might like to do the same.
    If you need further help reply back 
    Omar

Maybe you are looking for

  • I get this error message when trying to update CS6.0: U44M1P7

    Flash Pro CS6 update 2 Installation failed. Error Code: U44M1P7 I am running windows 7.

  • CSS Not Rendering

    While viewing my site in DW8, I can see my CSS styles at work, such as padding around the content areas. However, when I view in IE6, the styles are not shown: Dreamweaver View Browser View What could I be doing wrong? Thanks in advance for any feedb

  • IPhoto does NOT import " .pictClipping " files ?

    Hi, I copied pictures of artists from Amazon on the Web and put them together with the songs in iTunes Artwork. So far so good. I wanted to import these pics in iPhoto. I dragged them on the desktop en tried to import them via iPhoto 'Add to library'

  • Relationship between operation

    Hi all, Is it possible to process the operation with sequence(including goods movements) . In my order it has 4 operations, i have to process the operations with sequence, that means second operation will process after confirming the first operation

  • Target Group to file - u0093DATA FILEu0094 contents

    Hello When you export target group to a file, it gets stored in application server as Data file and Meta File. How can one see the contents of “DATA FILE” Thanks & Regards, Raju