Skip to Content
avatar image
Former Member

Dynamic table

Hi All

i need to develop a table in webdynpro

in that table in last colunm i have add and delete button

on clicking add button i need to add a row immediatly to next row

upon pressing delete button i need to delete the current row

Please gudie me how to handle this

Thanks

Karthi D.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 06, 2008 at 06:28 AM

    hi

    For deleting the current row you do like this.

    onActionDelete(..){

    wdContext.nodePerson().removeElement(wdContext.nodePerson().currentPersonElement());

    }

    For adding a row

    onActionadd(..)

    {

    IPrivateFirstCompView.IPersonElement pelement=wdContext.nodePerson().createPersonElement();

    pelement.set<attriute>(....);

    wdContext.nodePerson().addElement(pelement);

    }

    (or)

    if you want add a row in particular position,you can do this.

    i-->position

    IPrivateFirstCompView.IPersonElement pelement=wdContext.nodePerson().createPersonElement();

    pelement.set<attriute>(....);

    wdContext.nodeT_Return1().addElement(i,pelement);

    I hope this will solve your problem.

    Regards

    sowmya.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 06, 2008 at 05:11 AM

    Hi,

    Just get the index of the current selected row using

    int index = wdContext.node<nodename>().getLeadSelection();

    for adding a row immediately below this

    create an element of the node type

    IPublic<componentName>.I<nodename>Element ele = wdContext.node<nodename>().create<nodename>Element();

    Add this element at the index

    wdContext.node<nodename>().addElement(index,ele);

    For removing the current element

    wdContext.node<nodename>().removeElement(wdContext.node<nodename>().current<nodename>Element());

    Regards,

    Murtuza

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 06, 2008 at 07:23 AM

    To Add

    onActionAddNewRow()

    IPublic<componentName>.I<NodeName>Element element = wdContext.create<NodeName>Element();
    wdContext.node<NodeName>().addElement( element);
    

    To delete:

    onActionDeleteRow()

    IPublic<componentName>.I<NodeName>Element element = wdContext.current<NodeName>Element();
    wdContext.node<NodeName>().removeElement( element);
    

    nikhil

    Add comment
    10|10000 characters needed characters exceeded