Skip to Content
avatar image
Former Member

How to build a Hieararchical Table


I follow the below link to create a tree structured table.

The document says, the child nodes are rendered only when a parent node is clicked at runtime. Is it possible to show all the parent and child nodes at the same time.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 23, 2007 at 01:26 PM


    Yes, this is possible.

    In example for tutorial, add additional parameter isRecursive type=boolean to method addCatalogEntries.

    Then alter method body like below:

    public void addCatalogEntries(
    .IPrivateTreeTableView.ICatalogEntriesNode node,
    java.lang.String parentId, boolean isRecursive )
      //@@begin addCatalogEntries()
      IPrivateTreeTableView.ICatalogEntriesElement newCatalogEntriesElement;
      for (int i = 0; i < Catalog.getLength(); i++) {
        if (parentId.equals(Catalog.getParentId(i))) {
          // create new context node element
          newCatalogEntriesElement = node.createCatalogEntriesElement();
          // provide node elements with data
          if ("ARTICLE".equals(Catalog.getCATALOGTYPE(i))) {
            // checkbox is visible by default
            // third level is last level
          } else {
            // a CATEGORY or ARTICLEGROUP does not use the checkbox column
          /* ADDED CODE */
         if (isRecursive) {
             newCatalogEntriesElement.getID(), true
           // THIS EXPAND ITEM ON UI

    Now you can invoke

    addCatalogEntries(wdContext.nodeCatalogEntries(), "ROOT", true);

    in wdDoInit and you are done.

    Valery Silaev

    SaM Solutions

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Valery.

      Thanks for the reply, It was useful. But I have a different scenario.

      My issue on using tree structured table is:

      The Database structure is:

      MaterialTemplate - contains list of all material templates. It has reference to MaterialMD

      MaterialMD - contains all newly created materials

      MaterialValue - Contains the materials with markups and prices. It has reference to MaterialMD

      MaterialGroup - which contains other details with Materialtemplatereference.

      Now I have two scenarions:

      1. Create a new Materialgroup.

      While creating a new material group, I will select one material template which shows

      the list of materials in it (which is in hierarchical structure). From RFC it takes the cost for each material . Then I need to give some

      markup vaue and do some calculation, and finally while saving it saves all materialinformation to MaterialGroup table and cost, markup, materialMD information into

      MaterialValue table.

      Now I come back to main dashboard.

      2. View Materialgroup details

      When I click a materialgroup, now it shows the details of it.

      Also it has to show the information for this mateial group and bucketMD details in the table .

      When I come to the table structure I have to show the information taking from MaterialValue table, where all the data has been saved finally.

      My Question here is: While creating the material group, the information that has to be shown in the table has to come from one table(Material Template)

      and while showing the material group details it has to show the information from MaterialValue table.

      If I use the example as it is in above document Can I implement this scenario because the information is coming from two tables in each scenario.

      My only concern is when I click the parent object in the tree structured node, its information will differ depends upon from where to get it.

      Can I use the existing document to continue this process.Or Could you provide me some tips how to proceed this.

      Many Thanks