Skip to Content
avatar image
Former Member

Runtim assign child attr to parent attr on getLeadSelection action of Table

Hi all,,,I want to add child attr's to to parent attr at runtime at the action of getLeadSelection of the table control so that all the columns values entered during runtime shud be made as child to the first column to create the tree structure of that row..

the parent value shud in the first row and its child attr's in their respective columns in the table so to create tree structure dynamically..

If anybody knows how to achive plz share or provide information on the same..

Anxiously waiting for reply..

Thanx in advance.

Regards:

Hanif.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 05, 2009 at 09:18 PM

    Hi Shaikh,

    I believe you are using TreeByNestedTableColumn as mentioned in your other posts in this forum. For showing a hierarchy in a table first you need a homogeneous node. I guess these are the attribute that you need to show in the hierarchy. ProjectName,ProjectTask,ProjectUser,ProjectStartDate,ProjectEndDate. From your previous [post|Go to new Row in table;. And project name is the root of the hierarchy. So your hierarchy would look like this.

    ProjectName       ProjectTask      ProjectUser      ProjectStartDate  ProjectEndDate
    ProjectA
                         Task1          User1           date1                  date2
                         Task2          User3           date1                  date2
    ProjectB
                         Task1          User1           date1                  date2
                         Task2          User3           date1                  date2

    If this is correct then you need to create a context node (Parent) with all the attributes above. Below that node create a recursive node (Child).

    //For creating a parent node use the following code.
    IPrivateParentNodeElement parent = wdContext.nodeParent().createParentElement();
    
    //Now you can set the value for the parent.
    patent.setProjectName("ProjectA");
    wdContext.nodeParent().addElement(parent);
    
    IPrivateParentNode childNode = parent.nodeChild();
    //Now you can create the child nodes.
    IPrivateParentNodeElement child1 = childNode.createParentElement();
    child1.setProjectTask("Task1");
    child1.setProjectUser("User1");
    .
    .
    .
    childNode.addElement(child1);
    

    You can also do this at runtime.
    IPrivateParentNodeElement parent = (IPrivateParentNodeElement)wdContext.nodeParent().getElementAt(1);
    IPrivateParentNode childNode = parent.nodeChild();
    //Now you can create the child nodes.
    IPrivateParentNodeElement child1 = childNode.createParentElement();
    child1.setProjectTask("Task1");
    child1.setProjectUser("User1");
    .
    .
    .
    childNode.addElement(child1)

    Let me know if this helps.

    PS: The code was hand written so it might have syntax errors 😊

    Sanyev

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 22, 2009 at 04:43 AM

    closing

    Add comment
    10|10000 characters needed characters exceeded