XML for a Tree Control
I am trying to create a Tree control for my application that lists account reps as branches with their clients as leaves below them.
I created the xml below from a CGI script, but when the tree renders it the account reps are leaves and the clients don't show up at all. There is evidently something basic I am missing. Can anyone tell me what xml to do what I am shooting for should look like?
<Result>
<node>
<label>Bill Smith</label>
<data>AM|01</data>
<node>
<label>125 Company</label>
<data>COMPID|2177</data>
</node>
<node>
<label>ABC Manufacturing</label>
<data>COMPID|2167</data>
</node>
<node>
<label>Test Company</label>
<data>COMPID|2172</data>
</node>
</node>
<node>
<label>Jane Jones</label>
<data>AM|01</data>
<node>
<label>126 Company</label>
<data>COMPID|2100</data>
</node>
<node>
<label>XYZ Service Company</label>
<data>COMPID|2101</data>
</node>
<node>
<label>Test Company 2</label>
<data>COMPID|2102</data>
</node>
</node>
</Result>
At this point it is just a test application so the code is pretty small. For retrieving the data, I pretty much copied code from one of the examples. I created an HTTP request since I plan to return results from a CGI interface rather than a web service. My data provider is derived from the lastResult property of the HTTPService "userRequest".
<?xml version="1.0"?>
<!-- containers\layouts\HDivBoxSimple.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="send_data()">
<mx:Script>
<![CDATA[
private function send_data():void {
userRequest.send();
]]>
</mx:Script>
<mx:TitleWindow width="100%" height="100%" layout="absolute" title="Task Management" fontFamily="Verdana" fontSize="12" backgroundColor="#F0F0F0">
<mx:HDividedBox x="0" y="30" width="100%" height="95%" >
<mx:Tree width="15%" height="100%" id="treeCompList" dataProvider="{userRequest.lastResult.Result.node}" enabled="true"></mx:Tree>
<mx:TileList width="60%" height="100%"></mx:TileList>
<mx:DateChooser width="180"/>
</mx:HDividedBox>
<mx:Canvas x="0" y="-10" width="390" height="35">
<mx:Button x="4" y="10" label="Reports" cornerRadius="0"/>
<mx:Button x="80" y="10" label="Due Today" cornerRadius="0"/>
<mx:Button x="174" y="10" label="Past Due" cornerRadius="0"/>
<mx:Button x="258" y="10" label="Events" cornerRadius="0"/>
</mx:Canvas>
</mx:TitleWindow>
<mx:HTTPService id="userRequest" url="http://192.168.1.20/cgiGroupFlex.exe" useProxy="false" method="POST">
<mx:request xmlns="">
<FUNCTION>GetAMCompList</FUNCTION>
<FORMAT>TREE</FORMAT>
</mx:request>
</mx:HTTPService>
</mx:Application>
Similar Messages
-
Custom Run Time Menu (.rtm) for a tree control doesn't appear in LV executable
Hello,
I am using a custom run time menu (.rtm) for a tree control in LV. When I right click on the control the run time menu appears in the LV development environment. However the run-time menu does not appear when run the executable installed by the installer I created. I tried including the .rtm file with the installer, but it did not fix the problem.
Please let me know if any ideas.
Thanks,
RussellThis is a known issue and has been reported to our R&D engineers for further investigation (CAR# 3T2E57V2). The workaround is to embed the run-time menu in the control instead of the separate .rtm file. To do this, make a minor change in the shortcut menu (for instance, add a dummy item then delete it), so that the shortcut menu editor will ask you to save the new menu. When it prompts you, choose to save it with the control instead of to file.
-
Changing size area with help of mouse for custom tree control....
Hi,
I was creating a module pool program where I get tree control on left handise and HTML viewer on right hand side taking the help of example 'SAPSIMPLE_TREE_CONTROL_DEMO' . But I wanted the left hand side custom control adjustable i.e I move the size area by using mouse. (The way it happens in SAP standard screen) How can I do this ?
Please hlep.
Regards,
Jainam,Solved it myself. I have to use split container for this....
-
Query to create XML for a Tree Menu
Hi,
How can I generate a hierarchical xml. I have one table with 4 columns with menuid, menuname, parentid, link.
MenuID MenuName ParentID HREF
1 File
12 Open 1
11 New 1
21 Program 11
61 Program2 11
31 Blank 21
2 View
22 Printer
23 Doc
4 Tools
5 Win 1Here is the output I am trying to have.
<menus>
<menu name="File" id="1">
<menu name="Open" id="12" href="Open.jsp"/>
<menu name="New" id="11">
<menu name="Program" id="21">
<menu name="Blank" id="31" href="Blank.jsp"/>
</menu>
<menu name="Program2" id="61" href="Program2.jsp"/>
</menu>
<menu name="Win" id="5" href="Win.jsp"/>
</menu>
<menu name="View" id="2">
<menu name="Printer" id="22" href="Printer.jsp"/>
</menu>
<menu name="Doc" id="3" href="Doc.jsp"/>
<menu name="Tools" id="4" href="Tools.jsp"/>
</menus>ThanksHi,
How can I generate a hierarchical xml. I have one table with 4 columns with menuid, menuname, parentid, link.
MenuID MenuName ParentID HREF
1 File
12 Open 1
11 New 1
21 Program 11
61 Program2 11
31 Blank 21
2 View
22 Printer
23 Doc
4 Tools
5 Win 1Here is the output I am trying to have.
<menus>
<menu name="File" id="1">
<menu name="Open" id="12" href="Open.jsp"/>
<menu name="New" id="11">
<menu name="Program" id="21">
<menu name="Blank" id="31" href="Blank.jsp"/>
</menu>
<menu name="Program2" id="61" href="Program2.jsp"/>
</menu>
<menu name="Win" id="5" href="Win.jsp"/>
</menu>
<menu name="View" id="2">
<menu name="Printer" id="22" href="Printer.jsp"/>
</menu>
<menu name="Doc" id="3" href="Doc.jsp"/>
<menu name="Tools" id="4" href="Tools.jsp"/>
</menus>Thanks -
Tree Control Property Node for Accessing "Child Text" String Array
When adding items to a tree control using the EditTreeItems invoke nodes, the inputs include "Child Tag", "Item Indent", "Child Only?", "Glyph Index", "Child Text", and "Left Cell String" as can be seen in this screenshot.
There are property nodes for the tree control for accessing each of these elements, except for the "Child Text", which is an array of strings. It is possible to access this data as outlined in this forum post, but this method is somewhat involved and round about.
I suggest that a property for the Tree class be created to access the Child Text array directly.The work around only works if you do not have an empty string element some where in the middle.
At lest could the "Active Celltring Property" read return an error when you have gone beyond the end of the array. -
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 -
Hi All,
I have a need for a tree control which supports having a
combobox. I've done extensive research on Google, but came up
empty. If anyone has or can point me to any examples, it would be
greatly appreciated.
Thanks in advance!
-jfHere's a follow-up to my first question.
I found an example of a tree with checkboxes and set out to
modify it so that it would fit my needs. I'm really stumped here,
because it will render a checkbox or radio button fine, but I can't
get it to render a combobox or button. I'd also like the combobox
and button to be on the right side of the parent/child label, is
that possible?
Any help anyone can provide is greatly appreciated.
Content of ComboBoxTreeRenderer:
package util
import mx.controls.Image;
import mx.controls.Tree;
import mx.controls.treeClasses.*;
import mx.collections.*;
import mx.controls.ComboBox;
import mx.controls.Button;
import mx.controls.RadioButton;
import mx.controls.listClasses.*;
import flash.events.Event;
import flash.events.MouseEvent;
import mx.events.FlexEvent;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.xml.*;
import mx.core.IDataRenderer;
public class ComboBoxTreeRenderer extends TreeItemRenderer
protected var myImage:Image;
// set image properties
protected var myComboBox:ComboBox;
protected var myRadioButton:RadioButton;
protected var myButton:Button;
public function ComboBoxTreeRenderer ()
super();
mouseEnabled = false;
override protected function createChildren():void
super.createChildren();
myRadioButton = new RadioButton();
addChild(myRadioButton);
myComboBox = new ComboBox();
addChild(myComboBox);
myButton = new Button();
myButton.setStyle( "label", "Button" );
addChild(myButton);
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data)
if (super.icon != null)
myRadioButton.x = super.icon.x;
myRadioButton.y = 2;
super.icon.x = myRadioButton.x + myRadioButton.width + 17;
super.label.x = super.icon.x + super.icon.width + 3;
else
myRadioButton.x = super.label.x;
myRadioButton.y = 2;
super.label.x = myRadioButton.x + myRadioButton.width + 17;
Content of comboBoxTree_test.mxml:
<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init();" >
<mx:Script>
<![CDATA[
import mx.collections.*;
[Bindable]
public var treeList:XMLList =
<>
<folder isBranch="true" label="Branch 1" >
<folder isBranch="false" label="Leaf 1" />
<folder isBranch="false" label="Leaf 2" />
</folder>
</>;
[Bindable]
public var folderCollection:XMLListCollection;
private function init() : void
folderCollection = new XMLListCollection(treeList);
comboBoxTree.dataProvider = folderCollection;
]]>
</mx:Script>
<mx:Tree
id="comboBoxTree"
itemRenderer="util.ComboBoxTreeRenderer"
labelField="@label"
width="100%" height="100%" >
</mx:Tree>
</mx:Application>
************************************************************** -
Copying data between tree controls
I am currently using a tree control to list the tables in a database
(with columns as the children under each parent table). Since I
need to duplicate the tree control several times on the front-panel and
display the same data in each, is there a simple way to use data from
one tree control to populate the others? While I could get around
this problem by writing a subVI and running it for each tree control,
it seems as if it would be more efficient in terms of time and memory
to build one tree, and then copy it to the others.
The only other option I can think of is to write a subVI that traverses
the template tree and duplicates all tags in the target tree. The
problem with this, however, is I don't see a way to duplicate the
display text that was associated with each tag.
Any suggestions?
Thanks!
BradFor some reason the attachment did not go through. Re-attaching ...
Attachments:
Tree Transfer.zip 16 KB -
Hi friends.........
Iam using flex tree control data coming from coldfusion file to display grid. As i click the tree folder to change the data from dynamic from grid.
How to pass the folder id from coldfusion file.. Is it possible ?.. Means give any example please....
Any One Help Me......
With Regards.,
Lingu.......When you set the dataProvider for your tree control, you actually pass an array or arraycollection or whatever to that property. The array contains objects coming from your server, right? Each object should contain a property with the folder id, something like:
var arr:Array = [{id: 1, folderID: 34, name: "..."}, {id: 2, folderID: 4, name: "..."}, ...];
Now, when you click an item in your tree or your dataGrid, you can access the folder id by:
myTree.selectedItem.folderID
Hope this helps
Dany -
Hi experts,
How to create tree node with folder symbol dynamically in alv tree control.
Thanks
Ramesh VRIt is just a tree structure display in ALV output mode
BCALV_TREE_DEMO Demo program for ALV tree control
Many times in Finance there are requirements where User wants to see balance sheet report based on cost center groups and cost centres within it in this form -
Can a tree control express a heirarchical query?
Hi,
Are any of the tree controls data aware?
nullThe tree controls are not data aware. Creating a data model for a
tree control is highly dependent on the data so it is best left
to the developer to design.
Regards,
JDeveloper Team
Sotiri Bonanos (guest) wrote:
: Hi,
: Are any of the tree controls data aware?
null -
How to change the symbol not provided by LV in tree control
AS we know ,Lv7.0 provide the new "tree" control
,but the symbol provided is just some black_white
icon.if I want to chang the icon as I enjoy ,
how to do?You can create your own symbols (icons) for the tree control. First, create an invoke node for your tree control and select "Custom Item Symbols -> Set Symbol Array". You must build an array of images to feed to the method. You can right-click on the item in the invoke node and select Help for it.
Once your custom symbol array is set, you can designate an icon for each item on the tree with the property "Active Item Properties -> Symbol Index".
Daniel L. Press
PrimeTest Corp.
www.primetest.com -
LV 7 Tree Control--Create Method doesn't work
Just wondering if I broke something already or if this is a minor bug... when I try to create a method for a Tree Control I can only create the first five on the menu (non-control-specific) or the Double Click Method. These are all listed directly without sub-items while all other methods in submenus do not create a method when they are selected. Selecting them makes the menu disappear but nothing happens and there is not a method to place as is usually the case. The method can be created using a workaround--using one of the selectable methods (Double Click for example), then using the finger pointer to select a different method, but not by right clicking on a reference to the tree and trying to create method.
Att
ached is a screenshot--all items on the lowest level menu with an arrow to the right do not work.
Attachments:
nomethods.jpg 58 KBCongratulations. Looks like you found a bug... Probibly related to the submenus--don't remember methods having submenus before V7. In any case, you can also get at those methods if you drop down an invoke node from a palette and wire up the reference. Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Tree Control Highlighti​ng Programmat​ically Selected Item
Does anyone know whether it is possible to highlight a programmatically selected item in the LV Tree Control, eg I have used the "Get Child" method to select an item - how do I then highlight this item on the tree?
Yes, you can write the value to a local variable for the tree control. This will have the effect of selecting the item--which will highlight just ike the user clicked on it.
By the way, "Get Child" doesn't select an item in any sort of useful sense--it just tells you what the child is. Actually, it tells you what the first child under the indicated Parent is.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Problems handling xml data for tree control.
Hi,
I have tried using tree control for displaying my xml data
but I had a problem that i did not have labels in my xml data. A
sample xml data is attached. So it displays the whole data at each
level in the tree. The root label will be the entire the xml data
and then one level down the remaining xml data and so on...
How do i solve this issue i,e get the tags names itself as
labels..
Thanks in advance....An update after some efforts..
Could get the folders perfectly i.e until the level of
CPUTime perfectly but could not get the leaf: 32 since i used the
following to set the label.
I would like to know if there is a way to find out if a node
is a leaf or folder and according set the label
Maybe you are looking for
-
Database Performance: Large execution time.
Hi, I have TPC-h database of size 1GB. I am running a nested query having multiple joins between 5 tables and a group by and order by on three attributes. It took around 1 hour for this query to get executed (also it was fired for the point which can
-
Picture Manager with command line for Bat files
Hello I am wondering if Microsoft Picture manager has any command line switches i could use. I resize thousands of photos weekly using Picture manager for a semi automated process. The resize is the part that is not automated. For some reason when u
-
Can I create a button that will take me to a random slide in a sequence?
Let's say I have three simulations setup and the simulations start on slide 5, 15, and 23. Can I make a button that will randomly jump to one of those slides?
-
Software Cross Compatibility?
I have a Zen Vision M 30GB and a Creative Zen 32GB. I'm running Win XP.......will any of the explorer packages that come with them work with both units. The last time I tried they gave me issues when I tried to install both. Thanks
-
My Ipod Touch 4 has been stuck in Headphones Mode for no apparent reason.
Tried everything: Hair Dryer Blow/Sucking Q-Tip Headphones in and out RESET RESTART SOUND OPTIONS Anything else?