cancel
Showing results for 
Search instead for 
Did you mean: 

how to add and delete row in atable

Former Member
0 Kudos

hi

i have atable with no records and visible row count is 5 and i have two buttons ADD and Delete.when ever i click on ADD button a new row should be appened to the existing rows in atble and when i click on DELETE button selected row should be deleted (UI elements)along structure can u please tell me the required code for the above scenario

thanks

kishore

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

closed

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

to insert a new record

IPrivate<viewname>.I<node_name>Element element = wdContext.create<node_name>Element();

wdContext.node<node_name>.addElement( element );

to delete a record

wdContext.node<node_name>().removeElement(wdContext.node<node_name>().getElementAt(wdContext.node<node_name>().getLeadSelection()));

Abhi

Former Member
0 Kudos

hi

am able to add and delete arow but problem comes when deleting the row, when i delete the selcted row only the UI elements of thet row r deleted not the structure,so can u tell code to delete the structure of table as well

thanks

Kishore

piyush_kumar6
Active Contributor
0 Kudos

Hi kishore ,

After deleting the node , get the current size of node in one value attribute of

type integer and at design time you

set visibleRowCount properties of table to this value attribute .

like

if(wdContext.nodeTravel().size()>0)

{

IPrivateV_TravelRequestView.ITravelNode travelNode=wdContext.nodeTravel();

IPrivateV_TravelRequestView.ITravelElement travelElement;

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

{

if(your condition on which node/row will be deleted)

{

i--;

travelNode.removeElement(travelElement);

wdContext.currentContextElement().setTravelDestinationRowCount(wdContext.nodeTravel().size())

// visibleRowCount propertyof table is set to TravelDestinationRowCount attribute

}

}

Edited by: piyush kumar on Jun 16, 2008 9:49 AM

Edited by: piyush kumar on Jun 16, 2008 9:51 AM