Create treetable node programmatically

Hi,
I have a treetable that has some first level nodes (parent). I need to create and add their children (second level) nodes programmatically.
There is a sample code below, but it doesn't work. There is no error but it didn't add the children nodes.
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding) ((CollectionModel)this.getMyTree().getValue()).getWrappedData();
List children = treeBinding.getChildren();
Object element = children.get(0);
JUCtrlHierNodeBinding nodex = (JUCtrlHierNodeBinding)element;
DCIteratorBinding iter = ADFUtils.findIterator("ChildrenStoreIterator");
ViewObject vo = iter.getViewObject();
RowSetIterator rsi = vo.createRowSetIterator(null);
+while (rsi.hasNext()) {+
Row row = rsi.next();
JUCtrlHierNodeBinding childNode = new JUCtrlHierNodeBinding(treeBinding,nodex,treeBinding.getIteratorBinding(),treeBinding.getTypeBindings()[0],row,true);
nodex.addChild(childNode);
+}+
Thanks,
Mehmet.
Edited by: mdoldur on 03.Haz.2010 11:43

Hi Nick,
Thanks for reply,
I have allready binded and refreshed the table by
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(this.getMyTree());
But any node didn't be added.
Why I have chosen this method (Add child node manually) :
I have two VO these have only transient attributes, I mean these VO are not EO based and there is no any SQL query.
There is a viewlink between theese VO (First VO has parent records, second one has child records)
I get the records via a mehtod and fill them to the parent and child viewobjects.
Finally I would like to show the records as a treetable, but it didn't show the child records, it shows only parent records.
The viewlink doesn't work with treetable or tree objects.
So I can not use your second advice.
I think this is a bug and I have a workaround that is not useful.
I have gave up to show records as a tree table, I show the records as parent-child tables.
Thanks,
Mehmet.

Similar Messages

  • Create Parent Node programmatically

    Just wondering if it is possible to add Child ScopeNode on clicking Custom right click action on custom Node.
    ScopeNode object, appeared after I handled action in my test assembly has scopeNode.Children.Add() method. But, I'm not sure how can I create a ScopeNode object which whill be a child for one I've clicked.
    Thanks in any advice.

    Hi,
    SCCM 2012 Right Click Menu Editor might help you to create the configuration files for the Right Click Menus.
    For the script part, you could get better support from Scripting forum.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home
    Best Regards,
    Joyce Li
    We
    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.

  • Not able to expand Treetable structure programmatically

    We had implemented expanding Treetable structure programmatically. But when we are uptaking our UI to PS4, the expand operation is not working and we are getting exceptions.
    We are expanding Treetable through program, for example when try to expand first child of first node, we are passing Disclosed keys like 0,0 to the Treetable using the setDisclosedRowKeys() method.
    While trying to expand we are getting the following exception:
    No data found for key 0, 0
    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #5
    Please correct me if I miss anything.

    this code works for me..
    disclosedRowKeys="#{pageFlowScope.orderBean.disclosedTreeRowKeySet}"
    rowDisclosureListener="#{pageFlowScope.orderBean.rowDisclosureListener}">
    public void rowDisclosureListener(RowDisclosureEvent rowDisclosureEvent)
    Iterator added = rowDisclosureEvent.getAddedSet().iterator();
    if (added!=null)
    while (added.hasNext())
    Object rowKey = added.next();
    //disclosedTreeRowKeySet.clear();
    List path = (List)rowKey;
    for( int i=0; i< path.size(); i++ )
    List<Object> nodePath = new ArrayList<Object>();
    for( int j=0; j<i; j++ )
    nodePath.add( path.get( j ) );
    disclosedTreeRowKeySet.add( nodePath );
    disclosedTreeRowKeySet.add( rowKey );
    System.out.println( "disclosed Keys...... " + disclosedTreeRowKeySet );
    private void expandSelectedFundingNode(RowKeySet addedObj) {
    if (sourceTreeTable != null) {
    Iterator added = (Iterator)addedObj.iterator();
    if (added!=null)
    while (added.hasNext())
    Object rowKey = added.next();
    List path = (List)rowKey;
    for( int i=0; i< path.size(); i++ )
    List<Object> nodePath = new ArrayList<Object>();
    for( int j=0; j<i; j++ )
    nodePath.add( path.get( j ) );
    disclosedTreeRowKeySet.add( nodePath );
    disclosedTreeRowKeySet.add( rowKey );
    sourceTreeTable.setDisclosedRowKeys(disclosedTreeRowKeySet);
    }

  • How to collapse the expanded nodes programmatically?

    Hi,
    I am using Jdeveloper11.1.1.4
    Use Case:
    Level of the tree is 2; Like Root has Department and child has Employees
    Use Case:
    I have exapanded Department 10 root node and on click of Department 20 root node,
    the department 10 root node must collapse.
    How to achieve this?
    Thanks
    RajGopal K

    In order for all the nodes in a treetable to be expanded, you would need to add all the rows to the disclosedRowKeySet.
    1) Create a binding for the treetable in managed mean code as 'treeTable'.
    2) In actionListener for the commandButton, invoke the following method 'expandTreeTable':
        public void onExpandButtonClick(ActionEvent actionEvent)
            this.expandTreeTable();
        private RowKeySet disclosedTreeRowKeySet = new RowKeySetImpl();
        private void expandTreeTable()
            if (this.treeTable != null)
                disclosedTreeRowKeySet = new RowKeySetImpl();
                CollectionModel model = (CollectionModel) treeTable.getValue();
                JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) model.getWrappedData();
                JUCtrlHierNodeBinding rootNode = treeBinding.getRootNodeBinding();
                disclosedTreeRowKeySet = treeTable.getDisclosedRowKeys();
                if (disclosedTreeRowKeySet == null)
                    disclosedTreeRowKeySet = new RowKeySetImpl();
                List<JUCtrlHierNodeBinding> firstLevelChildren = rootNode.getChildren();
                for (JUCtrlHierNodeBinding node: firstLevelChildren)
                    ArrayList list = new ArrayList();
                    list.add(node.getRowKey());
                    disclosedTreeRowKeySet.add(list);
                    expandTreeChildrenNode(treeTable, node, list);
                treeTable.setDisclosedRowKeys(disclosedTreeRowKeySet);
        private void expandTreeChildrenNode(RichTreeTable rt, JUCtrlHierNodeBinding node,
                                            List<Key> parentRowKey)
            ArrayList children = node.getChildren();
            List<Key> rowKey;
            if (children != null)
                for (int i = 0; i < children.size(); i++)
                    rowKey = new ArrayList<Key>();
                    rowKey.addAll(parentRowKey);
                    rowKey.add(((JUCtrlHierNodeBinding) children.get(i)).getRowKey());
                    disclosedTreeRowKeySet.add(rowKey);
                    if (((JUCtrlHierNodeBinding) (children.get(i))).getChildren() == null)
                        continue;
                    expandTreeChildrenNode(rt, (JUCtrlHierNodeBinding) (node.getChildren().get(i)),
                                           rowKey);
        }Timo

  • Access Nodes Programmatically in Hierarchical Viewer

    Hi All
    Can any one tell me how to Access Nodes Programmatically in Hierarchical Viewer
    Tx

    How is the HierarchyViewer component populated (What is the data model for the HierarchyViewer)?
    What is your exact use-case/flow for your use-case?
    As the underlying data model/structure for the HierarchyViewer is exactly the same as the treetable, adding & deleting of nodes to the HierarchyViewer is exactly same as how we do for tree table.
    Thanks,
    Navaneeth

  • How to create a node with attributes at runtime in webdynpro for ABAP?

    Hi Experts,
             How to create a node with attributes at runtime in webdynpro for ABAP? What classes or interfaces I should use? Please provide some sample code.
    I have checked IF_WD_CONTEXT_NODE_INFO and there is ADD_NEW_CHILD_NODE method. But this is not creating any node. I this this creates only a "node info" object.
    I even check IF_WD_CONTEXT_NODE but i could not find any method that creates a node with attribute.
    Please help!
    Thanks
    Gopal

    Hi
       I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
    Note
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    My code is like the following:
    TYPES: BEGIN OF t_type,
                CARRID TYPE sflight-carrid,
                CONNID TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
      dyn_node   type ref to if_wd_context_node,
      rootnode_info   type ref to if_wd_context_node_info,
      i_node_att type wdr_context_attr_info_map,
      wa_node_att type line of wdr_context_attr_info_map.
          wa_node_att-name = 'CARRID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
          insert wa_node_att into table i_node_att.
          wa_node_att-name = 'CONNID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
          insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
                                       attributes = i_node_att
                                       is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition
    Message was edited by: gopalkrishna baliga

  • Create Value node instance from structure at runtime

    Hi,
    I have a requirement where an internal table is given with some details.
    Now I need to add each row of this internal table as one entity into a collection.
    For this I need to create value node instance for each entry of the table and then
    lr_collection->if_bol_bo_col~add( lr_entity ).
    this to add to the collection.
    Please tell me how to convert this one row of this table into entity.
    Regards,
    pooja

    Try it like this:
    DATA: lt_data type table of ty_line.
    DATA: ls_data type ty_line.
    For the value nodes we need an data object
    DATA: lr_line_ref type ref to ty_line.
    The value node which should be added
    DATA: lr_value_node type ref to cl_bsp_wd_value_node.
    First create the reference structure
    CREATE DATA lr_line_ref.
    *Loop over you itab
    LOOP AT lt_data into ls_data.
    Create the value node based on the ref line
    CREATE OBJECT lr_value_node
    EXPORTING iv_data_ref = lr_line_ref.
    Now set the data from the internal table
    lr_value_node->set_properties( ls_data ).
    Now add the created value node to the collection
    lr_collection->if_bol_bo_col~add( lr_value_node ).
    ENDLOOP.

  • How to create one node for multiple cards?

    I want a single minor device node to act as the interface to all instances of my pci-cards.
    I have the same pci-cards(pcixxx, xxx).

    You may want to create minor nodes on the fly
    using cloning or makedevice() interface.
    WDD has an example on it in xx_open() section,
    I believe
    Regards,
         Cyril
    I want a single minor device node to act as the
    interface to all instances of my pci-cards.
    I have the same pci-cards(pcixxx, xxx).

  • How to create Event Node in smartform

    Hi Experts,
    could you please tell me how to create event node in smartform
    Thanks in Advance,
    Thanks&Regards
    Geetha

    HI,
    plz explain your problem in deeply.
    And as per me you first create page and righ click on it
    Then create window as per your requirement.
    if you want to put condition ot events true or false Righ click on your window
    then goto flow logic -> Altenative
    You can found 2 events in Condition.
    So you can assign this events.If you want to put condition or event on test then goto Text here in General Attributes in bottom side you can find even on page.
    Try it.

  • Is it possible to restrict the user from creating a sibling and allow him to ONLY create child nodes in DRM?

    When in a hierarchy, a user right clicks on a node to crate a new node, he has two options
    -Child
    -Sibling
    Is it possible to restrict the user from creating a sibling and allow him to ONLY create child nodes?
    Business cases:
    1. different level nodes need to have different prefixes.
    - Thus, the default prefix property definition uses the level number to assign a prefix
    - Also, a validation, to ensure the correct prefix, uses the level number
    But if the user can create a child and a sibling then the default prefix will only be right for a single case and not both.
    Thanks

    If the images are exactly the same size then make sure the layer with the mask
    is the active layer and in the other documents go to Select>Load Selection and choose
    your document with the layer mask under Source document and under channel choose the layer mask.
    After the selection loads press the layer mask icon at the bottom of the layers panel.
    MTSTUNER

  • How to create a node in an interface in SFP transaction

    Dear All
    I am designing an Adobe forms template for which I am creating an interface.
    To pass the values I need to create a main node which contains both subnodes and attributes.
    How can we create a node for an interface?
    Just to add, this node will get its data  at run time from an ABAP web dynpro component. this component will get the data after executing some function modules.
    Regards
    Vineet Vkram

    Hi Vineet,
                       There is no way to create a node in the interface. But DDIC type interface can be created with similar structure to the node in the ABAP Web Dynpro Component.
    Ranganathan.

  • How to create a node in the transaction?

    Hi !
    In R/3 , How can i create  a node  underwhich I want to assign my generic datasource?
    I went to RSA5, there create node is hidden under hierarchy menu item.
    Waiting for your reply.
    Regards
    Durai

    Hi Vineet,
                       There is no way to create a node in the interface. But DDIC type interface can be created with similar structure to the node in the ABAP Web Dynpro Component.
    Ranganathan.

  • How to create xml nodes based on a value

    Dear friends,
    I've a question about graphical mapping in SAP PI...
    How can I create XML nodes on the target side based on a value in a XML field on the source side.
    For example:
    This XML field on the source:
    <NO_OF_LINES>4</NO_OF_LINES>
    Must result on 4 Lines on the Target:
    <LINE></LINES>
    <LINE></LINES>
    <LINE></LINES>
    <LINE></LINES>
    So it's actually the opposite of the Count function...
    I appreciate your help,
    Thank you in Advance,
    Kind regards,
    John

    Hi ,
    Try this
    NO_OF_LINES---> count---> UDF---> LINE
    example :
    UDF Code :
    for (int i=0;i<var1[0];i++)
    result.addValue("");

  • How to create a Node variable without fetching in Char Restriction.

    Hi Expert - I got the refrence from this thread -  [Hierarchy variables in webi / Universe;
    to create a node variable for hierarchies.
    Requirement - the  characteristic on which you want to create a node variable must not be in Default section and in Free Characteristics Restriction
    But - if we fetch any characteristic in free characteristic then it will appear in Default value section. I donu2019t want that , I donu2019t want that in Default Value section. how can i get this ?
    Also I need to create a node variable on profit center characteristic it without fetching it into Free Characteristics Restriction, Can I do this? How ?

    Hi Ingo - Thanks for your valuable input.
    After putting much efforts - here is result. I fixed my hierarchy , means now there is no hierarchy variable , And i just create a node variable by putting it into Bex characterstic  restriction. - But it looks like this in Universe.
    LovHierNodeL00 G/L Account
    LovHierNodeL00 G/L AccountBase
    LovHierNodeL01 G/L Account
    LovHierNodeL01 G/L AccountBase
    LovHierNodeL02 G/L Account
    LovHierNodeL02 G/L AccountBase
    LovHierNodeL03 G/L Account
    LovHierNodeL03 G/L AccountBase
    LovHierNodeL04 G/L Account
    LovHierNodeL04 G/L AccountBase
    Is this correct- ?
    What i feel is correct - it should look like this -
    LovG/L Account Node Variable
    LovG/L Account Node VariableBase

  • Create dinamic nodes and attributes

    Hi Forum!
    I have created a WDA with 2 views. On the START_VIEW, the user can input details from an installation.  I want to display an error on the START_VIEW when a condition is false.
    How I can create a node with an attribute dinamically to display this error if the message Text View is not defined on the view?
    Could you give me a any sample of code, please?
    Thank you very mucha and regards,
    Manuel.

    Hi Manuel,
    Pleaes try this out. This is how to create an attribute dynamically.
    DATA: attribute      TYPE wdr_context_attribute_info.
    DATA: main_node  TYPE REF TO if_wd_context_node_info.
      "get main node
      main_node = wd_context->get_node_info( ).
      "set name for this attribute
      attribute-name = 'SOME_NAME_4_ATTR'.
      "set data type for this attribute
      attribute-type_name = 'SOME_DATA_TYPE'.
      "add attribute into context node
      main_node->add_attribute( attribute_info = attribute ).
    Thanks.
    Regards,
    Georgy Norkin

Maybe you are looking for

  • Creating a new library from a DVD Burn library

    I have my entire library of photos on my iMac in iPhoto 6.0.6. I recently spent quite a bit of time cleaning up what had been a rather messy, unorganized, photo library. My organizational method consisted of consolidating old film rolls which were in

  • I am Having a Nightmare!!

    Hi I would really appreciate some help! I just got a new 5th gen black 30GB ipod yesterday and I am having major issues trying to get it to work. I have an ipod mini and so all my updates where completely up to date and so I connected this new ipod t

  • How to import premier xml file into FCP X?

    Hi There, Premier has an export to "Final Cut Pro XML" option but how do you import these files into FCP X? If I navigate from within FCP X, the file is greyed out and if I right click from the finder and open in FCP X I see the error: The document "

  • NEF Nikon D5100 - displaying too dark in LR

    I just bought a Nikon D5100. While importing the NEF files, LR firstly shows the images with the correct exposition (equal to the ones previewed in camera), then two seconds after (after fully rendering the image) LR darkens the images, so that they

  • Quicktime Codecs

    Okay, so my G5 just took a dump on me, and was just sent the new iMac from Apple as a replacement, I am now running the intel processor, and can't play .avi's. I downloaded the divx codec from the quicktime site, and can play them now, but I remember