Refresh a Tree XML dataProvider

I have a problem with refreshing a Tree dataProvider. This is what I use:
private var xmlFontes: XML;
I then use it to put some php/sql generated xml. And then I make it a Tree dataProvider.
So far so good... But I need to refresh the xml, and I use xmlFontes.refresh; and it works great. But I need to know when the refresh is complete, and I can't. Is it possible?
Thank you so much for your help!

Well... I don't know if I can explain mutch better... My english is not great!
I'm using a SpringLoadedTree, that I believe is some kind of tree but with more functions.
When my application initializes it makes this:
<mx:HTTPService id="treeF" showBusyCursor="true" url="php/treeFontes.php" resultFormat="e4x"  result="onResultFontes(event)" />
My treeFontes.php file queries a sql database and gives back some xml code. And then:
xmlFontes = XML(event.result);
And xmlFontes is the dataProvider of my tree. This tree I'm using lets me drag and drop items between the tree nodes. When I do that I call another HTTPService to update the node position on the database. When it finishes updating the database I call the <mx:HTTPService id="treeF"... again and it updates the tree.
What I wanted to do is this:
When I drag the node on the tree I save that nodes parent id and when I drop it I save the new parent node id - confusing. With this I was hopping to be able to open the tree nodes from where I dragged and droped the child node. I can do this, but only with the click of a button...
In my onResultFontes function I call another function that does what I want, but it's not working, beacause I don't know if it has finished generating the tree, and it probably tries to open the nodes before they are created.
The function to open the nodes previously opened does something like this:
expandParents(node[0]); - This is the original node - saved on drag
expandParents(node[1]); - This is the destination node - saved on drop
It's quite confusing... But I can't think of a better way.
Thanks and sorry for all the confusing explanation!

Similar Messages

  • Dynamically refresh a Tree

    Hi Everybody,
    I need to get Tree nodes refreshed based on some criteria.
    The criteria will be based on a combobox or PopupMenuButton change
    event. To achieve the same, I am using a Tree control, which is
    being populated by an XMLListCollection. The XMLListcollection has
    a filterFunction that filters the tree nodes that will be
    displayed. The criteria for the filterFunction depends on a
    ComboBox selection.
    The filterFunction for the XMLListCollection is called during
    the Combo change event but the tree data is not refreshed and
    doesnot display the desired filtered result.
    I have tried doing this for a arraycollection with a datagrid
    and it works fine but doesnot work for a tree. How can we refresh
    the tree data. Below are the code snippet used to perform the Tree
    filter which is not working and not throwing any error as well.
    <mx:Application xmlns:mx=""
    layout="vertical" creationComplete="SetFilter();"
    creationPolicy="all" >
    import mx.controls.Alert;
    private function SetFilter():void{
    xlc.filterFunction = treeFilter;
    private function treeFilter(item:Object):Boolean{
    var blResult:Boolean = false;
    var csProject:String = [email protected]();
    // + " .. " +
    if(csProject.indexOf(cmbTree.selectedLabel.toString()) !=
    blResult = true;
    return blResult;
    <mx:XML id="xmldata" source="data/treedata.xml"/>
    <mx:XMLListCollection id="xlc"
    source="{xmldata.node}" filterFunction="treeFilter"/>
    <mx:Tree id="trTest" dataProvider="{xlc}"
    labelField="@label" showRoot="false">
    <mx:ComboBox id="cmbTree" change="xlc.refresh()">
    <mx:Object label="By Licensee, Project" data="By
    Licensee, Project"/>
    <mx:Object label="By Licensee, Project, File Type"
    data="By Licensee, Project, File Type"/>
    <mx:Object label="By Licensee, Date" data="By Licensee,
    <mx:Object label="By Licensee, Date, Project" data="By
    Licensee, Date, Project"/>
    treedata.xml file has the following data that is displayed as
    tree nodes.
    <node label="By Licensee, Project">
    <node label="Abc">
    <node label="Mugs"/>
    <node label="Test" />
    <node label="By Licensee, Project, File Type">
    <node label="Abc123">
    <node label="Mugs1"/>
    <node label="Test1" />
    <node label="By Licensee, Date">
    <node label="Abc456">
    <node label="Mugs2"/>
    <node label="Test2" />
    <node label="By Licensee, Date, Project">
    <node label="Abc567">
    <node label="Mugs3"/>
    <node label="Test3" />
    Please advise and suggest on where I am going wrong or if
    there is any other better way to perform the desired result.

    You can not filter but can you refresh the tree control? Or
    do you have to build a new dataprovider every time ... What if you
    want to add an item to a node such as:
    {label:"topper", children:[{label:"one"}, {label:"two"}]}, 0);
    once you add the item you have to expand the node that you
    added it to ... how do you get the tree to refresh ... i have tried
    and my dataprovider is an ArrayCollection

  • Problem of refreshing a tree in web dynpro java

    hi all,
    I'm facing a problem for refreshing a tree in web dynpro java for SAP HR.
    I created a viewset with 2 cells( 1 view for each).
    In the 1st view I created a droplistbyindex to select the unit ID and in the 2nd view ( defaut=false)  I called a method to populate my tree according to my selection in the 1st view ( method called in wdInit).
    When I make the first selection everything is ok.
    But when I select another unit ID, the tree is not changed and I know the context is well changed according to my selection.
    So I think the method is executed only the first the view is called.
    In this case, how can I refresh my tree on real-time?
    Thanks for your help

    May be u can write the code wdDoModify instead.

  • Could not load or refresh node tree creation failed on node

    Hi Experts
    I created one user with MSS role and ERP COMM role.
    It is working fine. We restarted the server for other purpose. Then surprisingly the MSS role was locked. I am unable to see the MSS tab in the top level navigation.
    When i expand the workset in line manager -> Manager Self Service -> Worksets
    I am getting the following error::
    Could not load or refresh node tree creation failed on node:
    I can be able to expand and priveiw the Pages and iviews, except the worksets
    Please guide me, i am badly stucked here.

    Check the below thread and notes mentioned in that
    Re: Tree creation failed on node: pcd:portal_content
    Koti Reddy

  • How to auto refresh a tree region

    Is possible to automaticaly refresh a tree region?

    Anyone can help me with this?
    Edited by: macwadu on 4/Ago/2011 3:10

  • FPN Could not load or refresh node Tree creation failed on node: pcd:-Error

    I´m configuring a FPN using CRM Java as a producer and SAP Portal as a consumer, the SSO from SAP Portal to CRM Java is working fine, but we are having this Error when trying to Expand Content Administration > Portal Content > NetWeaver Content Producers > MyProducer System
    Could not load or refresh node Tree creation failed on node: pcd:NetWeaver_content_producers/........
    Also in Identity Management I can see the Federated Data Source but when search for roles no rol is retrieved and returns two messages.
    Last Search might be innacurate
    No element Found
    Has somebody faced this Error?
    Thanx in Advanced!
    Kind Regards,
    Gerardo J

    Check the below thread and notes mentioned in that
    Re: Tree creation failed on node: pcd:portal_content
    Koti Reddy

  • Manual Drag and Drop from Tree to Tree with XML dataProvider

    Been struggling with Drag-n-Drop between Tree controls. As far as I can tell, it doesn't work very well.
    I have boiled it down to a minimal project below and would be ever so grateful if someone can tell me what I am doing wrong.
    The complete MXML application file is below. Flex 3.5.
    Two trees side-by-side. One has XML that I want to drag over to the drop tree.
    On the DragOver() event, I select the node which is given to me by the calculateDropIndex() function.
    After startup; first open the L1 branch on the left and drag L11 over and drop it on the right Tree.
    Looks good, root node is selected/highlighted and dropFeedback is correct and dropping the node drops it as a child of "Start Here".
    Open the Start Here root node to see it.
    Now proceded to #1 below.
    Here are the problems:
    1) Drag "L12" from the left tree over to the middle of the right tree (below "L11" just dropped). "L11" will not be selected. The Selected node (with dropIndex=4) will be the entire new nested XML "<L><L11/></L>"; and therefore only "Start Here" node will be highlighted. Drop "L12" anyway. So, it is acting like selectedIndex = <anynumber> will only select the root node. How do I get the new L11 to show as a drop target?
    2) Now drag "L21" from the left tree onto the right tree; again starting below all nodes on the right tree. Selected node will not change until you drag it above #2 out of 3. Then, you can drag it anywhere, and correctly highlight/select any node as the target, and get that node in code. This is a problem. Go ahead and drop it anywhere. Now if you drag, for example, L22 from the left it will correctly highlight/select any node without having to first drag above #2 in the list.
    3) Now, grab and drag L11 a second time and drop it at the bottom on the right. Drag L23 over. No matter which L11 you hover over, it highlights the one at the bottom. How can this be right?
    Those are the bugs I would like to figure out. If I am doing it wrong, I sure would like to know what I am doing wrong. The code below is distilled down to one simple mxml application module.
    <?xml version="1.0" encoding="utf-8"?>
    xmlns:mx="" layout="horizontal" minWidth="955" minHeight="600">
    import mx.collections.XMLListCollection; 
    import mx.core.IUIComponent; 
    import mx.managers.DragManager; 
    private var dragXML:XML = 
    <Tree label="root"><L1 label="L1">
    <L11 label="L11"/>
    <L12 label="L12"/>
    <L2 label="L2">
    <L21 label="L21"/>
    <L22 label="L22"/>
    <L23 label="L23"/>
    </Tree> ; 
    private var dragXMLListCollection:XMLListCollection = new XMLListCollection(dragXML.*); 
    private var dropXML:XML = 
    <Tree label="root"><L label="Start Here"/>
    </Tree> ; 
    private var dropXMLListCollection:XMLListCollection = new XMLListCollection(dropXML.*); 
    // ************* Drag Drop Events ********************
    private function dragEnter(evt:DragEvent):void
    if (evt.dragSource.hasFormat("treeItems")) DragManager.acceptDragDrop(IUIComponent(;}
    private function dragOver(evt:DragEvent):void
    // Calculate dropindex and set selected item
    var dropIndex:int = dropTree.calculateDropIndex(evt);dropTree.selectedIndex = dropIndex;
    // setting the selected item based on calculateDropIndex()
    var selNode:XML = dropTree.selectedItem as XML; // Getting XML for selected node in Tree
    var selNodeName:String = (selNode != null ? selNode.localName() : ""); 
    // Get dragged XML
    var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]); 
    var dragNodeName:String = dragNode.localName(); 
    trace(evt, "\n", dropIndex, "\n", (selNode ? selNode.toXMLString() : "null"), "\n", dragNode.toXMLString()); 
    // you cannot drop a shorter name on a longer name
    if ((dragNodeName.length >= selNodeName.length) && (selNode != null)) DragManager.showFeedback(DragManager.COPY); 
    else DragManager.showFeedback(DragManager.NONE);}
    private function dragDrop(evt:DragEvent):void
    // get selected node in drop tree
    var selNode:XML = dropTree.selectedItem as XML; //selected in dragOver() event
    // Get dragged XML
    var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]); 
    // Drop logic
    // Compare dragNode.localName().length to dropNode.localName().length
    // if drag longer; drop as child
    // if drag is equal; drop as sibling
    // Drag can never be shorter in this example.
    var isChild:Boolean = String(dragNode.localName()).length > String(selNode.localName()).length; 
    if (isChild){
    null, dragNode);}
    selNode.parent().insertChildAfter(selNode, dragNode);
    <mx:Tree id="dragTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
    true" dragMoveEnabled="false" dropEnabled="false" />
    <mx:Tree id="dropTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
    {dropXMLListCollection}"dragEnter="dragEnter(event);" dragDrop="dragDrop(event);" dragOver="dragOver(event);"

    I just found out that by setting the dataProvider for each tree to the XML variable instead of the XMLListCollection variable, problems #1 and #2 went away!
    But the documentation says to use an XMLListCollection if you will be dynamically changing the tree contents.
    And, I just found out that #1 returns if I specify showRoot="false". But with it set to "true" that problem goes away. Is there some sort of minimum XML required to make drag-n-drop work on these Tree controls?
    Hmmmm. It appears that (for #3) the calculateDropIndex() will always return the last matching XML node - by name - in the tree.

  • Tree control and XML dataprovider

    I am trying to get this 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(;
    trvTreeview.dataProvider = tmp.node;
    I get such output

    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.

  • Expand all on tree when dataprovider is an object.

    When I first start the application I would like to have the
    tree and all nodes fully expanded. My RemoteService returns an
    object that looks like the snippet below.
    I have seen a lot of code on how to expand all nodes of a
    tree, but I do not have a tree.selectedItem yet as I have just
    created the app. I would like to add an expand all to the
    creationComplete on the tree but I an not sure what to pass the
    tree.expandItem. I have tried to pass tree.firstVisibleItem. I have
    tried to iterate over the children of the root object of my
    dataprovider. I can do it with xml but can't seem to figure it out
    using an object. Any ideas?

    I tested with your data structure and the following worked
    for me. I called expandAll(myTree,true) on creationComplete and all
    nodes were open on load.

  • Problems with codepage after refreshing data from XML

    I've created a dashboard with XML connection.
    XML file with new data is created via macro in INPUT.xls Excel file. This INPUT.xls file was created through exporting spreadsheet from Xcelsius and then adding a macro to it, so text data should be this same codepade. Generated XML through macro have no errors and Flash file gets numeric data with no problems.
    But there is other problem with text's codepage. After reload there are some unidentified symbols in place of polish alphabet letters.
    What should I do to make it right? Is this a problem with codepage or something else?
    [Dashboard Before Refresh|]
    [Dashboard After Refresh|]
    If you have any idea hot to fix it, please let me know.
    Best regards,
    Bart Dlug

    I have header in my XML as follows:
    <?xml version="1.0" encoding="Windows-1250"?>
    Only then my XML file is displayed correctly in Internet Explorer preview. When I chagne it to UTF-8 I get some errors.
    [XML with windows-1250 codepage|]
    [The same XML with UTF-8|]
    Error message means: Invalid character was found in text content. Error during processing resourcse file:///
    As I wrote before, my data is generated via macro in Excel, so I supose my data in this file has windows default codepage. Am I right?
    Do you think that I problem is XML file?
    Best regards,

  • Problem refreshing the Tree Component icons

    I'm using the Tree, adding the nodes dinamically, following the example:
    This Tree shows the access permissions from the users, and show a red icon on the itens without permissions and a green icon on the itens with permissions.
    In the nodes, I add an action that change this permissions when the user click.
    If the permission is Ok on the clicked item, the action remove this permission and vice-versa.
    The action is working fine, but the problem is the refresh of the tree after click. The icons stay like before the click. It is refreshed only if I navigate to another page and return after. Then the icons are showed correct.
    In the method that add the nodes, I select the node icons like this:
    if (havePermissionModulo(grupo, modulo)){
    Where imgPermissaoOk and imgPermissaoNegada have the path to the images.
    Sorry by my english :)

    It is hard to tell
    When the user clicks on an icon, is the page submitted to the server and the page redisplaying itself?
    Is the tree's clientSide property cleared (that is, false).
    Is the browser caching the images? What if you hit a Shift-Reload?

  • Getting xml dataprovider to reload information on page load... not compilation.

    Hey everyone,
    I've got an app that grabs information from a XML file on my server.  After the user has used the app, they'll have the option to save their input.  I've got the application to edit the xml file and store the users' information.  After saving the information, however, the XML datasource doesn't update the combobox that allows users to see passed saved saves.  Here's how it's being done now:
    This is the code to grab the XML file while I compile:
    <mx:XML id="applicantsXML" xmlns="" source=""/>
    Here's the combobox being populated with the XML information:
    <mx:ComboBox id="applicant_combobox" y="35" x="135" dataProvider="{}"></mx:ComboBox>
    Is there any way to get the XML to repopulate using applicationComplete or something like that?
    Thanks a bunch,

    By "Store the users' information" i mean that the application uses sliders, checkboxes, and textboxes.  After clicking the save button, these items will be saved into my DB and also put into an XML file.  I've gotten all that part working... the problem is updating the XML as the dataprovider.
    When you say "You can create a new dataprovider and reload the new XML file.  Then point the combox to the new data provider" I'm not sure exactly what you're saying.  Can you explain a little please?

  • XML - DOM tree - XML

    I'm building an application that takes an xml file, turns it into a DOM tree, then the user selects different options from a database to manipulate the internal information gathered by the original XML file, the program is a process and at the end of the process the original XML file has been updated with new information, i need help with finding some code to take the DOM tree information displayed to the user and save back out as a new XML file. any help would be greatly appreciated.

    You can use JDOM, Xerces XMLSerializer, or J2SE's Transformer. The first 2 are pretty simple. The 3rd isn't too hard. An example can be found in code sample 3 on

  • Refresh JNDI tree when accessing from outside the container

    I wrote a tool (a simple main class) which runs a thread to simply check the DataSources stored in an Application Server's JNDI tree (to see, if they can be used by other tools).
    The problem is: Once the thread is running, it always gets the same DataSource back, no matter if the DS's properties changed. Let me describe what happens:
    1. I defined a DataSource in Orion 2.0.5's data-sources.xml
    2. Testing it with an application in the container works fine.
    3. I start my external tool, which gets the DataSource and checks it - it works
    4. Then I stop the container and change the DataSource props in a way that the connection won't be established (i.e. wrong url)
    5. After restarting the container, the aplication in the container throws the expected SQLException
    6. But the external tool (which is still running) does its next lookup for the DataSource and gets a valid one and claims that everything is fine.
    Well, it seems to me that the external tool outside of the container somehow gets a copy of the JNDI tree (or something) and does no real lookup, but I just don't know. Another hint is, that - unless I do a context.list(""); before looking up the object - the container did not even need to run after the first lookup from the external tool - it just needed one lookup and afterwards I could stop the container without having the external tool recognizing any changes. Well, it at least recognizes that now by the above mentioned context.list(""); ...
    I hope I explained it right, let me just add some code of my tool.
    Thank you in advance for any hints!
    Greetings, Sebastian
    //only the important stuff...
    public class DataSourceChecker extends Thread {
       /** The array with the names of the data sources (command line args)). */
      private String[] _datasourceNames;
      /** Defines in seconds how long the thread sleeps. */
      private int _sleepSeconds;
      public void run() {
            boolean success;
            while (true) {
                //check each datasource...
                success = true;
                for (int i = 0; i < _datasourceNames.length; i++) {
                    if (!isDataSourceValid(_datasourceNames)) {
    success = false;
    try {
    sleep(_sleepSeconds * 1000);
    } catch (InterruptedException ie) {
    _log.error("Error while trying to put thread to sleep.");
    private boolean isDataSourceValid(String dataSource) {
    DataSource ds = null;
    Connection con = null;
    boolean success = true;
    try {
    ds = (DataSource)lookup(dataSource);
    con = ds.getConnection();
    //test the connection with something
    } catch (NamingException ne) {
    _log.error("Did not find datasource " + dataSource + ". " + ne.getMessage());
    success = false;
    } catch (SQLException sqle) {
    _log.error("Error while testing connection of datasource " + dataSource + ". " + sqle.getMessage());
    success = false;
    } finally {
    if (con != null) {
    try {
    } catch (SQLException sqle) {
    _log.error("Could not close tested connection of Datasource " + ds + ", exiting tool!");
    return success;
    private Object lookup(String name) throws NamingException {
    //I also tried to set the properties - with the same result
    /*String host = "ormi://";
    Hashtable rmi_env = new Hashtable();
    rmi_env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    rmi_env.put(Context.PROVIDER_URL, host);
    InitialContext ctxInitial = new InitialContext();
    ctxInitial.list(""); //need this to check if there actually is a context
    Object o = ctxInitial.lookup(name);
    return o;
    public static void main(String[] args) {
    DataSourceChecker dsc = new DataSourceChecker(args); //The constructor simply processes the command line args;

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
    Thanks for your understanding and support.
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to refresh the tree

    I am using jdev 11g
    in my page ,i use <af:panelSplitter> panel , left is my tree ,right is tree node details with dynamic region , because the different level has the different details page, so i use dynamic region
    But when the node details update or delete at right, my left tree can not refresh ,how to refresh with ManagerBean or others ?
    who can help me? thanks very much , i am waiting for your reply on line.

    hi, tks,
    in dynamic region , there is another page ,how to set PartialTriggers between two page(tree page and page in region ), perhaps it can't?

Maybe you are looking for

  • How can I use DFProfi II to monitor a Gateway ?

    Hi everybody I am a total newby to Profibus, so excuse me please, if this is a silly question: I have a Simatic S7 400 controlling (via Profibus) a robot application on a factory floor. The profibus network also contains a gateway slave to RS-232 whi

  • User Defined field in UDT - how to create select from existing data

    Hi I want to create User Defined Table for purpose of storing records of sales visits made to customers. I want to record detail for example: Date of Visit; Sales Employee; Activity number ref (which has attached PDF visit report); Related Opps) I am

  • What happens to indexes while DML

    what happens to index's while i execute the following statement step 1 > delete from emp; wht happens to index now ? step 2 > insert into emp select * from emp1; wht happens to index now ? step 3 > commit; wht happens to index now ? i only do insert

  • Create project task

    Hi, I wanted to know if there is an API to insert project tasks through pl/sql or we can do it through base tables directly. My requirement assumes inserting task for an existing project. Through my research, I came to find the api as pa_project_pub.

  • Printing of JTable on multiple pages

    i have jtable that contain too many column when i give printing through table.print() then table is print but it is too small to see it. i want some column of table on one page and some column on another page Plz give me source code so plz help me