APEX Tree.  Keep focus on expanded leaf node.

How do I prevent my tree from jumping back to the top when I expand a leav node that is below the screen scroll. I have a single parent of CORP with about 30 leaf nodes as its direct children. I have to scroll down to expand a node towards the bottom of the list. When I scroll down and expand, the page refreshes and jumps back to the top so now I have to scroll down again to expand the next node, etc. My current Tree Qurey is like
select CHILD_ID id,
PARENT_ID pid,
CASE WHEN CHILD_ID = :P23_TARGET THEN
CASE WHEN :P23_STATUS = 'Target Up' THEN
'<span styl="color:green;">' || ITEM_NAME || '</span>'
ELSE ITEM_NAME
END
ELSE
ITEM_NAME
END name,
'f?p=&APP_ID.:23:'||:SESSION||'::NO::P23_TARGET:'||CHILD_ID link,
null a1,
null a2
from CORP_SVR_HRCHY_VW

Hi,
You have to use the Anchor ID functionality of a browser - this allows you to add #id to the end of the url where id refers to the id attribute of the item that should receive the focus when the page is reloaded.
As an example: [http://apex.oracle.com/pls/otn/f?p=33642:200]
This, of course, requires a bit of setting up, but is easily doable.
For this example, my SQL statement for the tree is:
SELECT 1 ID, NULL PID, 'Top' NAME, NULL LINK, NULL A1, NULL A2 FROM DUAL
UNION ALL
select "EMPNO" id,
       1 pid,
       "ENAME" name,
       'f?p=' || :APP_ID || ':200:' || :APP_SESSION || '::::P200_EMPNO:' || EMPNO || '#node' || EMPNO link,
       'node' || EMPNO a1,
       null a2
from "#OWNER#"."EMP"You will note that the URL contains *'#node' || EMPNO* at the end of the link - for an EMPNO of 1234, this would add *#node1234* to the end of the URL. You will also note that I've added *'node' || EMPNO* to the A1 column - whatever I add into this column becomes available for use in the output by referencing it as #A1# in the template. On the tree's template definition, wherever there is an A tag, I've included:
ID="#A1#"as an attribute of the tag. For example, on the "Name Link Anchor Tag" setting, I have:
&lt;a href="#LINK#" ID="#A1#"&gt;#NAME#&lt;/a&gt;and, wherever #A1# appeared outside of an A tag, I have removed it (otherwise, the "node1234" text would appear at that point in the page).
Andy

Similar Messages

  • ADF Tree setting focus back to parent node after deletion of child node

    Hi,
    Is there a way to get the focus back to the parent node (or rather any particular node) in a tree?
    I have a use case where we need to get the focus back to the parent node after a child node is deleted.
    Currently the focus is shifted to the next node in the tree, but the need is to get the focus shifted back to the parent node. Also the parent node should be re-invoked to populate to get the latest status after deletion of the child node.
    Any help/pointers?
    Thanks

    Thanks for the reply Frank.
    I saw the link http://sreevardhanadf.blogspot.in/2012/07/showing-next-row-as-current-row-after.html
    However the issue is since I am using custom created tree using POJO tree item (composite object).
    calling myTree.getWrappedData() doesn't gives me a handle to JUCtrlHierBinding and subsequent access to JUCtrlHierNodeBinding.
    my program gives me data like -
    List<MyTreeItem> treeData = (List<MyTreeItem>)treeModel.getWrappedData();
    because my tree model is build using -
    treeModel = new ChildPropertyTreeModel(items, "children");
    where items is List of <MyTreeItem>
    Hence I am unable to get a handle using -
    List nodeParentList = nodeParent .getKeyPath();
    I am programmatically able to invoke the parent node to get the fresh data, only issue is the focus/selection of that node is not happening
    Is there a way around?
    Thanks
    Sachin

  • How to make the leaf node of the APEX tree downloadable

    Hi All,
    I am trying to build a "library" page for my application, with the documents as the leaf nodes of the tree. The documents come from a database table, and each document is a BLOB.
    My question is, how should I write the "link" part of the APEX tree query to make the lead node document downloadable for the end users?
    Thanks,
    Christine

    Hilary helped me out of this by creating a new form page with two new items there corresponding to the PK and BLOB column, then in the tree query use apex_util.get_blob_file_src function as the link. Below is the email from Hilary:
    1. Created Form, page 13, based upon your table storing the documents as BLOBs. The form page has just two associated items: P13_DOC and P13_DOC_ID. The item P13_DOC is of type FILE and contains a source type of DB column, which is the first required parameters of the function get_blob_file_src. NOTE: I could have created a form region on the same page as your tree, but chose to generate a separate page. You may choose to change this yourself.
    2. Updated the Tree query on pg 12 to use the following link for tree nodes of level 4:
    apex_util.get_blob_file_src('P13_DOC',v.attr3)
    ...where P13_DOC is the application page item mentioned in step 1 above, and v.attr3 should hold the unique ID associated with the document. Your tree now allows users to download the listed documents.

  • af:tree leaf nodes

    Is there a way to display leaf nodes in an <af:tree> differently, so that they don't look like they can be expanded?
    I'm using an <af:tree> component with an ADF tree binding. There's just one source collection, with a self-join (that is, the single accessor rule returns different elements from that collection).
    The problem is that every node in the tree is expandable, including the leaf nodes (that is, the ones with no children). When the user expands them, nothing happens except a change in the icon (as you might expect), but I'd rather not provide the icon at all, or provide a different icon, to discourage expansion.
    I actually have an attribute in my collection that can act as a discriminator--I happen to know that all and only rows with TypeIndicator="W" will have children. But my attempts to use the "polymorphic rule" functionality in the tree binding editor don't seem to work--it simply doesn't show any children of the top-level nodes at all.
    Help would be much appreciated.

    Mmm...sorta. Here's what I've done so far.
    I've created a class, let's call it CustomTreeModel, that extends the (abstract) class TreeModel. I've given it a private field:
    private final TreeModel mTree;and a constructor:
    public CustomTreeModel(TreeModel tree) {
        mTree = tree;
    }Then, I've overridden every method but one in TreeModel to delegate to mTree. For example:
    public void setRowIndex(int i) {
        mTree.setRowIndex(i);
    }The one exception is the method isContainer, which I've implemented this way:
    public boolean isContainer() {
        return (mTree.isContainer() && (! mTree.isContainerEmpty()));
    }The idea here is that the class wraps a tree, except that it claims that empty containers aren't containers at all (so they should be treated as leaves).
    Then, rather than bind my <af:tree> to #{bindings.MyTreeBinding.treeModel}, I bound it to #{myBackingBean.treeModelWrapper}, and created a backing bean with bean name myBackingBean. Here's what I did in the backing bean:
    1) Added a managed property, bindings, of type BindingContainer and value #{bindings}, and added a BindingContainer field, bindings, to the backing bean class.
    2) In the bean class, added a TreeModel field, treeModelWrapper.
    3) Changed the getter for treeModelWrapper so it looked like this (this is inexact, I don't have access to my code right now).
    public TreeModel getTreeModelWrapper() {
        Map myTreeBinding = (Map) getBindings().getControlBinding("MyTreeBinding");
        TreeModel oldTreeModel = (TreeModel) myTreeBinding.get("treeModel");
        return new CustomTreeModel(oldTreeModel);
    }That worked, inasmuch as the general structure of the tree looked about right, and leaf nodes showed up as leaf nodes.
    There are two problems with it. A little one and a big one.
    Little: It degrades performance significantly. Not surprising, since I assume isContainerEmpty() is a more resource-intensive method than isContainer(), and we're calling it a lot more often now. There's probably no way around this.
    Big: The data seems...a bit messed up. Most of it looks right, but I'm getting weird occasional spurious child nodes (meaning that occasionally a copy of a node is showing up in a container where it doesn't belong). Since the tree is based on a self-referential relationship, that occasionally leads to infinite loops (node A and node B show up inside one another, so you can just keep expanding downwards for ever). I can't for the life of me figure out why this is.

  • Keeping expended leaf node when reloading page for TreeNodeType

    Hi all,
    My page with context is:
    -TREE (node)
      ---TREENODE (node)
    CHILDNODE (node)
    name (attribute)
    value (attribute)
    I map this context into TREE as below:
    -TREE (element type: TREE; dataSource : TREE)
    ---TNT_NODE (element type: TreeNodeType; dataSource: TREENODE; hasChildren: TRUE )
    ---TNT_CHILDNODE (element type: TreeNodeType; dataSource: CHILDNODE; hasChildren: FALSE)
    Everything is ok, but my issue is:
    How TNT_NODE keep expanded (show child node as TNT_CHILDNODE) when page is reloaded? Now TNT_NODE collapse its leaf node when page reload. I tried using EXPANDED but it expands all nodes that is not my desire.
    Please give me your advice.
    Regards,
    Ken

    my issue is resolved

  • How to Find the node or leaf node selected in Tree UI element:

    Hi All,
    I have a tree structure with three level design. We have a button, which will perform some operation on the specific node or leaf node on every level.
    When we select any node or leaf node, we have action Onction getting called.  But what we want is that, after we select the node or leaf node,  we press a button below the tree design and perform some operation on the node selected.
    But how to get information that on Application , which node or leaf node has been slected ?
    Thanks
    PG

    Hi,
    Found the solution.
    Juts keep on reading all the nodes, system gives the complete path of the tree by using Lead selection and then we can use this path to peform the update operation on tree structure.
    Thanks alot for the hint.
    Regards
    PG

  • ADF TreeTable - How to hide Disclose/Expand icon for leaf node

    We are using ADF Tree Table in our application.
    Whenever a node is expanded - all the child nodes have the disclose/expand icon along with it.
    But, we don't want to show the disclose/expand icon if it is a leaf node.
    How can this be done?
    JDeveloper Version: JDeveloper 11.1.1.3
    Thanks,
    Navaneeth

    I have a hierarchical tree based on single POJO based class exposed as data control.
    (i.e) a node can have many levels.
    Can you specify how we can use the folder icon for this - Can you please provide some detailed information?
    Thanks in advance,
    Navaneeth

  • Apex Tree Node Search

    Hi guys,
    I want to search a tree node by using a textbox and a button item. I have implemented all required items and regions into my page. I think that, i can do this by using dynamic action. So I wrote a small script (jquery) to use in dynamic action in button click event. It gets the value of the textbox item and tries to use this value in tree's search method. By the way I specified a static ID for my tree region. (As you can see it is TREEID). But it doesn't work. Maybe usage of the method is different.
    So ,
    1 : The method usage is right?
    2 : Do you have any other idea about how can i do this search stuff.
    $("#TREEID").tree("search", document.getElementById("P300_SEARCH_TEXT").value);
    Database : Oracle11g
    Apex version : 4.1
    Thanks

    Mimi gave a very good start though. I have not worked with a tree before, but those tips guided me to the documentation, and i was able to take it from there. I can't see how the documentation would be lacking for you though, i find it to be clear. However, if you don't have some experience with javascript/jquery, this will not be straightforward.
    I made a new tree page, based this on EMP.
    When you want to do a search, you will first need the tree object, since the search function is a function of that object. I opened Firebug and ran this in my console:
    jQuery.tree.focused()This is in the docs. "This functions returns the currently focused tree instance."
    If you would have more trees, you could always use
    jQuery.tree.reference(needle)This functions returns a specific tree instance by an ID or contained node.
    Arguments:
    mixed needle
    This can be either the instance ID (the ID of the container node), an ID of any contained DOM element,
    an actual DOM element contained within the tree, or a jQuery extended DOM node container within the tree.>
    Now you have your tree object. Let's do a search. There are 2 employees with 'LL' in their names. I want to grab those.
    $.tree.focused().search("LL")This'll do "nothing". Why? Take a look at the documentation:
    Searches all nodes whose titles match a given string. If async is used a request is made to the server, the response should contain the comma-separated IDs of nodes that need to be opened so that all nodes that match the search string are visible.
    The search string is provided in the request. The function triggers the onsearch callback, with the nodes found as a parameter.
    Arguments:
    string needle
    The search string.
    string compare_function
    Optional argument. The jQuery function to be used for comparing titles to the string - defaults to "contains".>
    What is of importance here is this: The function triggers the onsearch callback
    +(oh, and please note that the search is looking for a match in the TITLE of the nodes!)+
    So, taking a look at onsearch:
    callback.onsearch Triggered after a search is performed and results are ready.
    Receives two parameters - a jQuery collection of nodes matching the search and a reference to the tree instance.
    *Default is: function(NODES, TREE_OBJ) { NODES.addClass("search");* }
    >
    So the default action of a search is something very simple: it assigns a class to the nodes which match the search criteria.
    If you would want more complex things to happen, you can simply provide another function to the tree object for the onsearch callback, and that is what Mimi meant with changing it. But you don't have to if the class-adding is sufficient.
    So, running from my firebug console:
    $(".search").css({"background-color":"red"})Grab all elements with class 'search', and give them a red background color. My nodes are now red for "ALLEN" and "MILLER".
    It also helps to use something like firebug, have knowledge of jquery, DOM and being able to inspect it, and read docs. I did not do anything special except applying some knowledge and taking my lead from those docs. Of course, Mimi mentioned this aswell, but the docs are at *\apex_images\libraries\jquery-jstree\0.9.9a2\documentation.html*
    Hope that helps you forward.

  • Displaying leaf nodes at the bottom of a tree that has parent nodes

    I have a problem in that - leaf nodes added to the tree at the bottom appear with big spaces (vertically) between them. It looks as if the nodes are somehow expanded by default!
    Is this a known issue with leaf nodes that are added in below parent nodes?
    I notice in the normal hierarchy the leaf nodes are displayed fine. Also if I return false on isleaf() it displays the last 3 nodes as expandable icons but they're still lage gaps between them.
    this is an example of what i'm getting
    Main �
    +Parent Node(expandable)
    |
    +Parent Node(expandable)
    |
    +Parent Node(expandable)
    |
    |
    |_leaf node (not expandable)
    |
    |
    |_leaf node (not expandable)
    |
    |
    |_leaf node (not expandable)

    You got my interest with your topic subject as I'm working on a library which simplifies the development with Swing trees. However everyone here except you knows nothing about your "anormal hierarchy" which creates you problem.
    Denis Krukovsky
    http://sourceforge.net/projects/dotuseful/

  • Regarding Leaf node indentation in tree

    Hi All,
    I need solution for indenting leaf nodes alone  in  Tree.
    regards,
    karthik

    Hi,
    Found the solution.
    Juts keep on reading all the nodes, system gives the complete path of the tree by using Lead selection and then we can use this path to peform the update operation on tree structure.
    Thanks alot for the hint.
    Regards
    PG

  • How to make the APEX tree in the "Expand All" shape by default?

    Could anybody please enlighten me on how to make the APEX tree in the "Expand All" shape by default please? I created an APEX tree and by default it's in the "Collapse All" shape. I am using APEX 4.1.0.00.21

    Hi,
    you can check the view source of html and check the onclick code written on that plus sign(Expand All), just copy that onclick javascript code and put it on page javascript event.
    Thanks,
    Jaydip Bosamiya
    +91-76000 23053
    http://jbosamiya.blogspot.com

  • ADF: Tree Refresh after Expanding a node. Please Frank have a look!

    About this post:
    Re: ADF: Tree Refresh after Expanding a node
    Frank answered that he doesn't notice that behavior. I found out that this happens if an appication uses a custom skin.
    In SRDemoSampleADFBC, SRManage.jspx (Management from menu), if you make the explorer window small enough not to cover the whole tree, you can notice this (the page jumps to the top).
    Now if you change in adf-faces-config.xml the "skin-family" tag to "oracle", you will see that the tree component has changed (it has no triangle icons why this happens) and the page doesn't refresh.
    Minas

    It seems that there's more to the tree expansion icon than the skin definition. We're using the minimal skin and ADF puts out a special character to represent the disclosure symbol (which by the way, renders differently on IE6, than IE7, than Safari or Firefox on Mac). However, switching to the Oracle skin, the disclosure symbol comes out as a full-on image (triangle including the +). We have found this frustrating because the triangles seem not sufficiently suggestive to our users - but switching to the Oracle skin has other issues with white-on-white text.
    But in any case, the tree refresh after node expansion is another annoyance as I described in the other thread linked here (including URL to see problem in action).
    Cheers, Mark

  • Tree table-initially expand all nodes raises error when closing a node 11g

    Hello,
    Frank Nimphius posted a blog entry about how to initially display all the nodes in a tree or table here:
    [http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/|http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/]
    This works very well. However, when the user tries to close a node, a NullPointerException is thrown.
    Below is the stacktrace.
    Does anyone know how to work around that issue?
    java.lang.NullPointerException
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl$Search.find(RowKeySetTreeImpl.java:608)
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl._setContained(RowKeySetTreeImpl.java:496)
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.add(RowKeySetTreeImpl.java:97)
         at oracle.adfinternal.view.faces.renderkit.rich.TableRendererUtils.decodeDisclosedRowKeys(TableRendererUtils.java:774)
         at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeIncompatiblePropertyKey(BaseTableRenderer.java:198)
         at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:203)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1089)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:714)
         at org.apache.myfaces.trinidad.component.UIXTreeTable.decode(UIXTreeTable.java:133)
         at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:193)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1113)
         at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1030)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
         at oracle.adf.view.rich.component.fragment.UIXPageTemplate.invokeOnComponent(UIXPageTemplate.java:208)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:664)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:303)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at edu.wisc.csa.web.ApplicationSessionExpiryFilter.doFilter(ApplicationSessionExpiryFilter.java:66)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at edu.wisc.csa.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:36)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:85)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:257)
         at oracle.security.jps.wls.JpsWlsSubjectResolver.runJaasMode(JpsWlsSubjectResolver.java:250)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:100)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    OK I have tried Frank's suggestion about the 2 entries in the managed bean and it works but I cannot collapse my child node !
    I have a Master-Detail-Detail setup.
    In the Grandparent I have this :
    RowKeySet rks = new RowKeySet(true);
    table1.setDisclosureState(rks);
    this.grandParentTable = table1;
    and in my Parent table I have this :
    RowKeySet rks = new RowKeySet(true);
    table2.setDisclosureState(rks);
    this.parentTable = table2;
    ie the same.
    In my child I have nothing just the default accessors.
    The collapse works OK for the Grandparent but when I click Hide for the Parent it does not do anything - no error message either.
    cheers

  • ADF Faces af:tree expand/collapse node

    Any help appreciated. Is there a way to specify in the tree model if you want a node expanded or collapsed? I am using the ChildPropertyTreeModel and TreeNodeImpl as the nodes. Can I add an additional property to the Tree Node?
    Thanks

    There isn't anything in the framework that lets you specify tree expansion state in the model. The frameword tries to preserve the abstraction between the model (which should only contain data) and the UI component (which handles expansion state).
    You can build a custom renderer for the tree where you can remember which paths from your model are expanded, and then set the expansion state of the tree programmatically by calling the UIXTree.setTreeState() method. It takes a set of paths, with each path corresponding to a path you want to be expanded.

  • Leaf node Hierarchy based on tree position

    Hi All,
    I need to find the Hierarchy of given leaf node. Can you please help me. Here are details
    create table t_rk_4 (child_id number, parent_id number, treenum varchar2(100));
    insert into t_rk_4 values (2,1,'1');
    insert into t_rk_4 values (3,1,'1');
    insert into t_rk_4 values (6,2,'1.2');
    insert into t_rk_4 values (7,6,'1.2.6');
    insert into t_rk_4 values (4,3,'1.3');
    insert into t_rk_4 values (5,4,'1.3.4');
    insert into t_rk_4 values (7,5,'1.3.4.5');
    insert into t_rk_4 values (8,7,'1.2.6.7');
    insert into t_rk_4 values (4,9,'1.9');
    insert into t_rk_4 values (9,1,'1');
    In the above date, child 8's parent is 7 only in case if tree context 1.2.6.7
    select child_id,parent_id connect_by_isleaf,level,lpad(' ',level*3)||a.child_id
    from t_rk_4 a
    start with child_id = 8 connect by child_id = prior parent_id ORDER SIBLINGS BY child_id;
    when I run the above query I am getting all tree contexts,
    Is there a way I can only get tree positins thru 1.2.6.7 ?
    In real table I have more than 1 million records..
    Any help would be helpful..
    Thanks
    ay.

    Hi,
    Welcome to the forum!
    Thanks for posting the CREATE TABLE and INSERT statements! It clarifies things a lot and makes it much easier to reply.
    Another very helpful thing is to post the results you want from the data you posted. In this case, I think you want:
    . CHILD_ID  PARENT_ID CONNECT_BY_ISLEAF      LEVEL INDENTED
             8          7                 0          1    8
             7          6                 0          2       7
             6          2                 0          3          6
             2          1                 1          4             2Is that right?
    Notice how multiple spaces are not compressed in the section above. That's because I typed &#123;code&#125; (all small letters, in curly brackets) before and after that section.
    To get those results, I just added one line to your CONNECT BY clause, saying that the parent's treenum has to be the first part of the child's treenum:
    SELECT     child_id
    ,     parent_id
    ,     CONNECT_BY_ISLEAF
    ,     LEVEL
    ,     LPAD (' ', LEVEL * 3) || a.child_id     AS indented
    FROM     t_rk_4     a
    START WITH     child_id = 8
    CONNECT BY     PRIOR parent_id     = child_id
    AND          PRIOR treenum     LIKE treenum || '.%'     -- *** NEW CONDITION ***
    ORDER SIBLINGS BY     child_id;What do you want to do if the node you're starting with has two (or more) parents?
    If we START WITH child_id = 7, the query above produces this output:
    . CHILD_ID  PARENT_ID CONNECT_BY_ISLEAF      LEVEL INDENTED
             7          5                 0          1    7
             5          4                 0          2       5
             4          3                 0          3          4
             3          1                 1          4             3
             7          6                 0          1    7
             6          2                 0          2       6
             2          1                 1          3          2That is, there are two rows in the table with child_id = 7, so the query shows two lines of ascent. The alternate route, going through the node with child_id = 9, is not shown. Is that what you want?

Maybe you are looking for

  • Delete song from ipod touch

    I read what I could find on deleting but I could not find out how to delete from the ipod touch.

  • Switched from iPhone 4 to Samsung Galaxy S4 and am not receiving iPhone text messages...

    Hello, I recently switched from the iPhone 4 to the Samsung Galaxsy S4 and am no longer able to receive text messages from other iPhone users. I have combed the forums looking for a solution and so far have come up empty handed. What seems to be work

  • Speed drops and lack of BT response

    Hi, Just venting my rage really, I have been attempting to get BT to recognise that something has happened to my connection and all I get is "it matches your IP profile". The thing is I have had 2 distinct step changes in speed, latency etc and they

  • How do i re-name my bluetooth name ?

    how do i rename my Bluetooth name on my iphone 4s?

  • RFQ for One Time Vendor

    Dear Experts , An RFQ is made for a vendor with the One Time Vendor code where its details are punched . Now after delibration , it is decided 2 procure the material form the OTV . But we want to maintain a new  Vendor Master Record for the  vendor .