Expanding Tree nodes in Web Dynpro

Hi,
I have created a recursive tree with two main nodes. These nodes contain subnodes.
The filling of these nodes has been done in wdDoInit().
The problem is that whenever I expand the second node, the first node also gets expanded.. even when it (first node) is not expanded.
When I go to some other window and then come back to this window (wdModify()),it works properly. i.e. the first node does not get expanded.
Plz help........
Thanks in Advance.
Regards,
harshada.

Hi Harshada
It looks strange to me that you use two main nodes on the first level. In the most cases it's enough to have only one node for each level of a tree.
Are the two nodes mapped to the same context node? If so you do not need the second node I think. Because when the first node is expanded the mapped context node will get the corresponding lead selection. But the lead selection will influence on the second node as well. That's why the tho nodes expand simultaneously.
BR
Sergei

Similar Messages

  • Expanding Tree nodes

    is it possible to expand tree node on rollover instead of
    clicking on the triangle?

    yes, that worked. thanks.
    private function itemRollOverHandler(event:ListEvent):void{
    tree.expandItem(event.itemRenderer.data, true, true);
    I think I was looking for something like getItem(index)..
    something similar to Flash AS 2 components.

  • Expand tree node by clicking onto the node label

    I have followed this example to expand the nodes with a clic on the tree :
    [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf]
    My code:
    JSPX:
    <af:resource type="javascript" source="js/glasspane.js"/>
    <af:tree value="#{bindings.OpcionesPadreView1.treeModel}" var="node"
    rowSelection="single" id="t1" partialTriggers=":::cbNuevCpta"
    binding="#{pageFlowScope.GestionDocumentos.t1}"
    selectionListener="#{bindings.OpcionesPadreView1.treeModel.makeCurrent}">
    <f:facet name="nodeStamp">
    <af:commandImageLink text="#{node.Gesdopcach}" id="ot1"
    action="#{bindings.LoadDir.execute}"
    actionListener="#{bindings.LoadFile.execute}"
    icon="/images/GestionDocumentos/folder20x20.png"
    partialSubmit="true">
    </af:commandImageLink>
    </f:facet>
    <af:clientListener method="expandTree" type="selection"/>
    </af:tree>
    Js:
    function expandTree(evt) {
    alert('In');
    var tree = event.getSource();
    rwKeySet = event.getAddedSet();
    var firstRowKey;
    for (rowKey in rwKeySet) {
    firstRowKey = rowKey;
    if (tree.isPathExpanded(firstRowKey)) {
    tree.setDisclosedRowKey(firstRowKey, false);
    }else {
    tree.setDisclosedRowKey(firstRowKey, true);
    When i clic on the labels the tree doesn't expand, the alert also is not shown. The problem could be the <af:resource>, but i have this tag in all my pages and all javascripts work. I also changed the commandLink with an outputText, but doesn't work.
    Edited by: Miguel Angel on 21/06/2012 12:53 PM

    At least the call the javascript works, but this line doesn't work, anybody know why?:
    rwKeySet = evt.getAddedSet();

  • Expand tree nodes

    Hi Experts,
    Working jdev 11.1.1.3.0.
    we are using tree component on the page which as 6 childs. so if i click on add button once it will add child to that node and once i click on save done will come back to tree page. so everything is working fine. but the problem is once the node is added child node is not expanding. to resolve this issue i am using tree object in session, but while using this process its taking lot of performance.
    manually i can able to expand the tree but if once i add node to the parent tree and coming back to the page node is not expanding i have to manually expand it.
    so can any one suggest me what could be the best approch to expand the tree.
    Thanks,

    Hi,
    Hope followings useful
    http://andrejusb.blogspot.com/2010/02/how-to-traverse-adf-tree.html
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/21-expand-tree-on-initial-render-169158.pdf

  • Tree Hierarchy in Web Dynpro

    Hello All,
    I want to create a web dynpro application that implements some functionlity that I saw in the SAP backend system. In the backend, I have a transaction that allows me to drill down into nodes and add and remove them with a right click context menu. This is like a tree structure with the ability to add, remove and modify node elements. I want to present this to the front end user using web dynpro and possible in a nice table format. How can I go about doing this? Any suggestions?
    Thanks
    Marshall.

    Ok, I try to explain with a simple example.
    Say, your context has the following structure:
    WebDynproClass (node, cardinality=0:n)
    - expanded (boolean)
    - name (string)
    - SubClasses (recursive node -> Class)
    Then, you can build the following tree:
    UIElement (root)
    + AbstractCaption (e_1)
       + AbstractButton (e_1_1)
          + Button (e_1_1_1)
    + RadioButton (e_2)
    with code like
    /* helper method, put inside //@@begin others...//@@end section */
    private IWebDynproClassElement addSubClass(String name, IWebDynproClassElement parent)
      IWebDynproClassElement child = (parent == null)
        ? wdContext.nodeWebDynproClass().createAndAddWebDynproClassElement()
        : parent.nodeSubClasses().createAndAddWebDynproClassElement();
      child.setExpanded(true);
      child.setName(name);
      return child;
    /* builds initial tree, call from wdDoInit() */
    private void init()
      IWebDynproClassElement root = addSubClass("UIElement", null);
      IWebDynproClassElement e_1 = addSubClass("AbstractCaption", root);
      IWebDynproClassElement e_1_1 = addSubClass("AbstractButton", e_1);
      IWebDynproClassElement e_1_1_1 = addSubClass("Button", e_1_1);
      IWebDynproClassElement e_2 = addSubClass("RadioButton", root);
    Now if you want to add "Caption" as subclass of "AbstractCaption" later, you have to find the context element that represents the "AbstractCaption" class and add it as above:
    IWebDynproClassElement parent = find("AbstractCaption");
    addSubClass("Caption", parent);
    If you have to implement the find() method at all depends on your application. Maybe you want to
    - provide a context menu (available since 7.1) on the tree nodes to add child nodes, or
    - provide a static menu at the table cell editor (since 7.0)
    - you provide a toolbar button to add a child node to the currently selected tree node (since 6.40)
    Example for a static menu at a TextView cell editor:
    Table (dataSource = WebDynproClass)
    + TreeByNestingTableColumn (expanded = WebDynproClass.expanded)
       + TextView (text = WebDynproClass.name)
          + Menu
             + MenuItem (id = AddChildItem, onAction = AddChild, nodeElement -> AddChild.parent)
    Action "AddChild" has text "Add Child" and a parameter "parent" of type IWebDynproClassElement. Action handler is
      public void onActionAddChild(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.demo.rec.treetable.comp.wdp.IPrivateMainView.IWebDynproClassElement parent )
        //@@begin onActionAddChild(ServerEvent)
        addSubClass("Child #" + parent.nodeSubClasses().size() + " of " + parent.getName(), parent);
        //@@end
    Then you will get a menu at each tree node with an entry "Add Child" that adds a new child node with some generic text.
    Armin

  • How to define 'First Vsible row'  for Tree table in Web Dynpro

    Hi,
    I am using a table with a treebykeytablecolumn. The user can change the selected
    line from another view and then I change the selected line within the tree according to his choice. This works fine.
    Unfortunatelly, I did not succeed to change the displayed page in the tree, so the user has to scroll up or down to see the selected data, if it is not on the current page.
    I try to bind the 'FirstVisibleRow', using the index of the selected element, but this
    index does not fit. The page changes, but as the index is somehow 'wrong', it is not
    the expected page that is shown.
    Looping at the node, my selected element get index 30, but the selected line is the 8th one (regarding what is current ly open or not in the tree) and the 14th if we expand all nodes above.
    So, is there a way to specify which line to be the 1st visible one when there is a tree column?
    thanks a lot for your help.
    reagrds,
    barbara

    Follow these steps,
    1- Create an attribute with char1 in the view context e.g first_vis_row
    2- go to the table properties in view and bind the property first_visible_row to this attribute.
    3- NOw go to the wddoinit method of the view...
    4- read the internal table and find out the index of the row which you want to set as first row. As in ur case you want a specific date in first row. So read the internal table and findout the index.
    5- now write this code, say your attribute name is first row inside node flag1...(you can change it for yoru requirement)
    DATA lo_nd_flag1 TYPE REF TO if_wd_context_node.
      DATA lo_el_flag1 TYPE REF TO if_wd_context_element.
      DATA ls_flag1 TYPE wd_this->element_flag1.
      DATA lv_first_row LIKE ls_flag1-first_row.
    * navigate from <CONTEXT> to <FLAG1> via lead selection
      lo_nd_flag1 = wd_context->get_child_node( name = wd_this->wdctx_flag1 ).
    * get element via lead selection
      lo_el_flag1 = lo_nd_flag1->get_element(  ).
    * get single attribute
      lo_el_flag1->get_attribute(
        EXPORTING
          name =  `FIRST_ROW`
        IMPORTING
          value = lv_first_row ).
    here change the lv_first_row to the index which you got after raeading the internal table.
    suppose it's
    lv_first_row = 4.
      lo_el_flag1->set_attribute(
        EXPORTING
          name =  `FIRST_ROW`
          value = lv_first_row ).
    Hope it works.

  • Moving expanded tree nodes in a JTree

    Hello.
    I have built a JTree that represents my hard disks. The files are sorted alphabetically. I already have built methods to create and remove directories, using the removeNodeFromParent and insertNodeInto methods in DefaultTreeModel.
    Now I would like to rename a directory, so (because of the sorting) sometimes nodes should move some indices up or down. When I use the methods mentioned above it just works okay, but when I have expanded the node to be renamed it and all of its children get collapsed.
    My question is: does anyone know of a convenient method to use for this problem? Thanks in advance.
    Kind regards, Levi.

    Hello guys,
    thanks for all your replies. I've figured it out myself (not with the tree API, though) using two recursive methods.
    Kind regards,
    Levi

  • Cannot expand tree nodes using t:tree tag

    Hi, I have a question.
    I am a beginner of JSF. I am trying to deploy a very simple tree using <t:tree> in my local tomcat server, similar to the following one:
    http://www.irian.at/myfaces/tree.jsf
    The result is that the tree is properly displayed, but I cannot expand the nodes when I click on the "+" icon of the nodes.
    Can someone help me? Thanks a lot!

    Take a look at Lilya Jsf Widgets and Ajax Capabilities at http://qlogic.ma/lilya
    the new era of technology

  • Expand tree node upto a fix level

    Hi all,
    I have a hierarchical tree in forms. I can expand all the node by the following code
    DECLARE
    htree ITEM;
    node ftree.node;
    state varchar2(30);
    BEGIN
    -- Find the tree itself.
    htree := Find_Item('BLOCK17.T_POP'); -- Find the root node of the tree.
    node := Ftree.Find_Tree_Node(htree, '');
    -- Loop through all nodes and expand each one if it is collapsed.
    WHILE NOT Ftree.ID_NULL(node) LOOP
    state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
    IF state = Ftree.COLLAPSED_NODE THEN
    Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.EXPANDED_NODE); END IF;
    node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node); END LOOP;
    END;
    But what i need is expand the tree upto a fix level. Suppose uptp level1 or level2. The rest of the level will be collapsed. What can i do? Pls help.
    Best regards
    Tarik

    Using node_depth you would change
    IF state = Ftree.COLLAPSED_NODE THENto
    IF state = Ftree.COLLAPSED_NODE and to_numbeR(ftree.get_tree_node_property(htree, node, node_depth)) <= 2 THENThis might not be the most efficient code because it will still loop through every node in the tree, but I think it will work.

  • Prompt LOV takes forever to expand the Node on Webi report based on BW Universe

    Hi,
    We have a Webi report migrated from 3.1 to our 4.1 (BI 4.1 SP2 P2) test environment.
    One of the prompt "Vendor" refreshes with LOV in a node structure however when I try to expand the node it takes forever and never opens.
    This prompt is predefined at universe level.
    Strangely on 3.1 I do not see node structure.
    This is on 4.1
    Has anyone come across such scenario.
    Please suggest.
    Regards,
    Asif

    hi,
    I am also facing same problem and nw m using Administrator(userName) then there is no need to be give other rights(administrator using FullControl) as u given
    Applications->Web Intelligence->User security()->Assign security->Advanced rights->Add/remove rights->Application->Web Intelligence->Enable drill mode.
    Plz let me any other solution.
    Regards,

  • Can't get BAPI return node in web dynpro!!

    I'm calling BAPI in web dynpro, I already map the <BAPIName>_Input->Output->Return to our custom controller context. I can get the value of some other output parameters in Output node, but can't get the return node.
    wdContext->currentOutputElement is Ok, but wdContext->currentBapiReturnElement is null, what is the problem??!!!
    Can anybody give me an hint, or give me a example to access the return value of Bapi??
    Thank you very much!
    Regards,
    Xiaoming Yang

    Hi Vitaliano,
    Thanks for your reply.
    yes, I've call the invalidate method, like this:
    wdContext.currentBapi_Trip_Create_From_Data_InputElement().modelObject().execute();
    //wdContext.nodeBapireturn().invalidate();//do I need this?
    wdContext.nodeOutput().invalidate();
    But it still can't work!
    The return node is a child note of Output, does it ok?
    Thank you!

  • WDA:  Tree structure in web dynpro for ABAP

    Hi,
    I am trying to build a tree structure with information something like the following:
    Country
    State
    City
    I used the UI Element "Tree" and I was successful in building it. The only problem is that it supports only one column in each row like name.
    I need multiple columns in each row like Name and population.
    1) Is there any solution for this using UI element "Tree" only?
    2)I checked that there is Table tree UI element, but I could not figure out how I could use it for hierarchial structure like that of my requirement? Can I use it? Is there any example application with hierarchial structure?
    3)For tree UI element, any node that is not directly below context node has to be non-singleton. It will lead to adverse performance. Is there any solution for this?
    Thanks in advance.
    Regards,
    Srini.

    Hi Srinivasa,
    In the context, please create a node DATA with the following fields:
    KEY type string
    PARENT type string
    LOCATION type string
    POPULATION type string (or "I" if you happen to have numbers only without a unit like "k" for "thousand").
    Then please create a table with a TreeByKeyTableColumn namde LOCATION and an additional TableColumn called POPULATION. Now please add a TextView cell editor to both and bind the text value of each of them to the attributes LOCATION and POPULATION of the context node DATA. Last step is to bind the attribtues rowKey and parentRowKey(?) to the KEY and the PARENT attributes. This concludes the design time part.
    Next step is to fill the node DATA with actual data. Just use a supply function and do it like this:
    First entry:
    KEY = 'WORLD'.
    PARENT = ''.
    LOCATION = 'World'.
    POPULATION = '4 billion'.
    Second entry:
    KEY = 'DE'.
    PARENT = 'WORLD'.
    LOCATION = 'Germany'.
    POPULATION = '80 million'.
    You should now see a table with a tree at the left column that looks like:
    <pre>
      World        4 billion
       ->Germany   80 million
    </pre>
    Kind regards,
    Thomas
    Message was edited by: Thomas Szuecs

  • Create Multiple dynamic Node in Web Dynpro Abap

    Hi Friends,
          I need your help.My object is to create Multiple dynamic dropdown UI element.I am able to create this dynamic Dropdown element. But i need to assign default different values to this dropdown elements.So i created dynamic nodes for each dropdown and created attribute with same name as that of value table.
       My issue is its giving me error as : -
    Lower-Level Node with Name ZDCN_BRD_STATUS.ME Does Not Exist
    Help me to rectify this error..
    Regards,
    Santosh

    Hi,
    This information is not enough for anybody to help you. Write more in detail about your code and where exactly in the code this error is coming.
    One trial experiment can be that you split your problem into two or more level.
    Create several nodes in your context with attribute and sample data.
    Create Dynamic UI (DDBI) and Bind these attributes to your DDBI.
    When it works perfectly, then tryout how to create the Node and attribute dynamically. This way you are not making it too complex to solve this problem.

  • Web Dynpro Tree expanding

    Hi there!
    I am using the tree element in web dynpro.
    Not the tree in the table.
    I need to expand a part of the tree during loading
    I do not find an example.
    Any help is warmly appreciated.
    Thanks in advance, Frank

    Hi,
    the "dynamic" tree expansion depends on who you populate the tree content e.g. how you load the data to your tree.
    In my application, I have choosen to load the root nodes, first - all over sub-nodes (including items) are loaded "on demand" that means the user clicks on the node. This click will trigger the the action onLoadChildren which pulls the data from a data provider and binds the retrieved data to the corresponding
    context node.
    This expansion can be perfomed automatically by a recursive method which is called when a user pushes a button called "Expand all"....
    I don't have much time to explain the details, but I will provided the source code..., hope it helps!
    Darko
    Source Code -
    Import to the Method:
    i_node_ref type IF_WD_CONTEXT_NODE = Reference to the context node
    METHOD nav_tree_expand_all.
    Data declaration
      DATA node_elements TYPE wdr_context_element_set.
      DATA node_element  LIKE LINE OF node_elements.
      DATA child_node    TYPE REF TO if_wd_context_node.
      DATA ls_tree_attr  TYPE zlm_str_tree_gen.
      DATA lt_tree       TYPE zlm_tty_tree_gen.
    Get all node elements
      node_elements = i_node_ref->get_elements( ).
    Loop over each element
      LOOP AT node_elements INTO node_element.
        " Get Static attributes
        node_element->get_static_attributes( IMPORTING static_attributes = ls_tree_attr ).
        " Check if data has already been loaded
        IF ls_tree_attr-children_loaded = abap_true.
          " now we know that the data has been loaded, only the elements have to be declared as expanded
          ls_tree_attr-is_expanded = abap_true.
          node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
          " get possible other nodes recursively
          child_node = node_element->get_child_node( 'SUBTREE' ).
          me->nav_tree_expand_all( EXPORTING i_node_ref      = child_node
                                             i_screen_id     = i_screen_id
                                             i_component_id  = i_component_id ).
        ELSE.
          " data has not been loaded yet...
          " First load the nodes...
         clear lt_tree.
          me->get_nav_tree_nodes( .....importing lt_tree.). Custom specific data retrieval
          IF lt_tree IS NOT INITIAL.
            child_node = node_element->get_child_node( 'SUBTREE' ).
            child_node->bind_table( lt_tree ).
            " Update Attributes of the node
            ls_tree_attr-is_expanded     = abap_true.
            ls_tree_attr-children_loaded = abap_true.
            node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
            " Call the method again recursively...
            me->nav_tree_expand_all( EXPORTING i_node_ref      = child_node
                                               i_screen_id     = i_screen_id
                                               i_component_id  = i_component_id ).
          ENDIF.
          " ... then load the items
          CLEAR lt_tree.
          me->get_nav_tree_items( .....importing lt_tree.).  Custom specific data retrieval
          IF lt_tree IS NOT INITIAL.
            " Update Attributes of the node
            ls_tree_attr-is_expanded     = abap_true.
            ls_tree_attr-children_loaded = abap_true.
            node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
            child_node = node_element->get_child_node( 'ITEM' ).
            child_node->bind_table( lt_tree ).
          ENDIF.
        ENDIF.
      ENDLOOP.
      RETURN.
    Edited by: Darko Mocelj on May 7, 2008 8:57 PM

  • How to get a Tree Node Value when a Tree is Expanded

    My reqiurement is when i Expand a Tree i need the Expanded tree Node Value. For Example Consider Parent as a Root Node of a Tree, and Consider its two Children Child1 and Child2.
    When + Parent Expanded
    I will Get the Output as --Parent
    - Child1
    - Child2
    so As when i expand the Tree i must Get the String Value Parent.

    duplicate
    How to get a Tree Node Value when a Tree is Expanded

Maybe you are looking for

  • Can I use the black ink cartridge only, & quit replacing the color cartridge when it's empty?

    I have an HP Officejet 6210 all in one printer that takes color ink (#95) and black ink (#94).   I only want to print in black and white.   The color cartridges are more expensive and since I don't want to use them, I don't want to replace it.  Can I

  • Display of Qual Characteristics in QE03 for Physical Samples

    Hi All, I am using result recording with physical samples. I am able to record Qualitative characteristics through transaction QE01. When i want see these "qualitative characteristics" in QE03 screen, just an icon appears in the "results" coulmn in R

  • My adobe xi pro doesn't automatically open pdf documents

    everytime I dowload a pdf document the  adobe xi pro does not open the document automatically.  I haveto open acrobat then find the download to open.

  • Displaying the PDF in the Acrobat reader?

    Hi all,        Is it possible to display/Open  the PDF that was generated in the SAP R/3 by using the following Function Modules from Portal BSP page? CONVERT_OTFSPOOLJOB_2_PDF QCE1_CONVERT I know there is a function module for e-mail the created PDF

  • WRT160N NOT DETECTED, whats the issue

    My computer is connected to port 1 and modem is connected to internet port of the router. I've also tried to reset. I held the reset button at the back of the router for 30 seconds then unplug the power for 30 seconds and plug it back in. - DOES NOT