cancel
Showing results for 
Search instead for 
Did you mean: 

Problems by adding children to a tree

0 Kudos

Hello,

i am trying to build a tree structure in a table by using MasterColumn UiElemnt. I have already checked some questions about the same Problem, but i think it's not my case. Hier is my pseudocode:

this method must add data to each Node element

addElementsOfTable( IPrivateChangeListikView.ITableNode node, String parentid){

if(parentid=="Root"){

while(Data.next())

newTableElement=node.createTableElement();

newTableElement.setTitel(Data.getString("CODELINE"));

......

newTableElement.setISLEAF(false);

newTableElement.setEXPANDED(true);

newTableElement.setCHILDRENLOADED(true);

node.addElement(newTableElement);

//!!!recursion!!!! nodeTableRec() is recursion Node

    • addElementsOfTable(newTableElement.nodeTableRec(),"Codeline");

}

else if(parentid="Codeline"){

while(Data.next())

newTableElement2=node.createTableElement();

newTableElement2.setTitel(Data.getString("PROJECTNAME"));

.....

newTableElement2.setISLEAF(false);

newTableElement2.setEXPANDED(true);

newTableElement2.setCHILDRENLOADED(true);

node.addElement(newTableElement2);

//!!!again recursion!!!

addElementsOfTable(newTableElement2.nodeTableRec(),"Projectname");

}

else if(parentid="Projectname"){

while(Data.next())

newTableElement3=node.createTableElement();

newTableElement3.setTitel(Data.getString("Number"));

...................................

newTableElement3.setISLEAF(true);

newTableElement3.setEXPANDED(true);

newTableElement3.setCHILDRENLOADED(true);

node.addElement(newTableElement3);

}

}

if i comment **, i see only the first level withought children, if i don't comment, table is empty at all, but Data is not empty...

Have you any idea? Could you help, please?

Thank you very much in advance!!!

Best Regards,

Daria

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

if you want to insert a record,the code what you have show is no problem,but then how to store the data of children.

And you say that you can only get the first level, but have no children, i think this is the problem,when you load current element 's children, you should do like this(at onActionLoadChildren method):

......................................

ITableNodeNode pNode = wdContext.nodeTableNode;

ITableNodeElement pElement = pNode .getCurrentTableNodeElement();

// if pElement is which you can't get children

ITableNodeNode node = pElement .nodeChild();

//if element1 is the children

node.addElement(element1);

you can have a try!

0 Kudos

hello, thank you very much for your reply and help! i have found finally an error, it was uncomment function node.invalidate() wich i called more times:)that's why i have always seen only an empty tree

Former Member
0 Kudos

Your string comparisons are in any case wrong. You have to use parentid.equals("Root") etc.

Armin

0 Kudos

Hi Armin,thank you for your reply...unfortunatly, my comparison of strings all right, i have just typed it here wrong. Still the problem remains