cancel
Showing results for 
Search instead for 
Did you mean: 

Tables - Removing child elements

Former Member
0 Kudos

Hi,

I have a WebDynpro application which popoulates a table using the data in a node .

The node has a child node in it.

--EmpDetails

*Name

*EmpID

--Personal Details

*<some details>

*<some details>

*<some details>

The table displays the name and empid and the selection is 1..n.

When a element is selected..

How do i delete the child node elements ALONE when the corresponding parent element selection is made.(for multi-selection of parent nodes)

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi ,

I think this will solve the problem .. will it !.

if(wdContext.nodeColleaguesData().isMultiSelected(i))

{

wdContext.nodeColleaguesData().setLeadSelection(i);

// and then remove the current element

}

All suggestions are welcome..!

Regards

Bharathwaj

Oops ! Seems like both arrived at the same solution !

Former Member
0 Kudos

Yes.

That is working

Regards,

Sowjanya.

Former Member
0 Kudos

Hi,

The code I mentioned later was working bcoz of setting the lead selection.Still as mentioned before only u will be able get lead selected ones.

Regards,

Sowjanya.

Former Member
0 Kudos

Hi Sowjanya,

The singleton node has a cardinality of 0..n . So it can store n values ...but at any particular instant it wil store only one.. am i right ?

When i multiselect the parent node elements.. i want the corresponding child node elements to be deleted ...Isn't tat theoretically possible to say that i will load each element value at a time to the singleton child node and then delete it..

If something is wrong with my understanding please do mention where i am getting it wrong ?

Regards

Bharathwaj

Former Member
0 Kudos

Hi Bharathwaj,

U have a parent Node of cardniality 0-n and tehn a child node of type Singleton and cardinality 0-n0r 1-1 or..

Now the at runtime the lead selected parent node will have a child instance and that is teh only instance that will exists right even if u multiselected 3 records of teh parent node also the lead selected parent instance will only have a child instance then how will u be able to delete the childnode instances of all the selected ones.So according to my understanding u can only delete the instance of the lead selcted ones and not all teh multiselected records.

Regards,

Sowjanya.

Former Member
0 Kudos

Hi,

Got an idea.

for(int i=0;i<wdContext.nodeVnEmployee().size();i++)

{

if(wdContext.nodeVnEmployee().isMultiSelected(i))

{

wdContext.nodeVnEmployee().setLeadSelection(i);

wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentVnDetailsElement().getVaName());

wdContext.nodeVnDetails().removeElement(wdContext.currentVnDetailsElement());

}

}

U can set the lead selection and then delete.

Former Member
0 Kudos

hello Bharathwaj

see in case of a singleton child node you only get the childnode instance (remember that a node instance is different from node element), not the element under the corresponding parent node and it points to the lead selection of the childnode. ( u will not get an instance of child node from a parent node element).

now if u add a child element under a parent node its actually added to the child node instance. so in order to reach that child element there is no need to go to that parent node element and then traverse to that childnode element. directly u can take the instance and traverse the childnode elements. so if u add N no. of child elements under a parent node, it gets added to the childnode instance which is unique.

regards,

Piyush

Former Member
0 Kudos

Hi Sowjanya,

The method you have suggested will work only in the case of non-singleton child nodes. If i have a singleton chid node how do i remove it ?

(I have edited my question .. ). I dont want to delete the parent element,but i want to remove the child element alone.

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

Yes it will not work in the case of singleton nodes.It will only work to remove non-singleton node child elements in a parent node.Do post if u have a sol for Singleton nodes.

Reagrds,

Sowjanya.

Former Member
0 Kudos

Hi Bharathwaj,

If u have a child node which is singleton at runtime u will have only one instance of childnode for the parent.Then u will only be able to remove that particular instances again in that case if mutliselected also only the leadselections instance of the parent node will only have teh instance of child node.Then u will only be able to remove that one

for(int i=0;i<wdContext.nodeCompanycode_List().size();i++)

{

wdContext.nodeVnChild().removeElement(wdContext.currentVnChildElement());

}

}

What is the idea behind having both multiselected for parent and having a singleton child node.

Regards,

Sowjanya.

Former Member
0 Kudos

Hi Bharathwaj,

If u want to delete the the child instances on multi slection on that particular action u can write

for(int i=0;i<wdContext.nodeEmpDetails

().size();i++)

{

if(wdContext.nodeEmpDetails().isMultiSelected(i))

{

wdContext.nodeEmpDetails().getEmpDetailsElementAt(i).nodePersonalDetails ().removeElement(wdContext.currentPersonalDetailsElement().currentPersonalDetailsElement());

}

}

Regards,

Sowjanya.

Former Member
0 Kudos

It would be nice if you can post the solution

Regards, Anilkumar