Skip to Content
avatar image
Former Member

Determine selected cell in table with buttons

Hi all,

I have a table in java web dynpro with buttons in all cells (TableCellEditor -> Button). All buttons refer to the same action and eventhandler. Within this eventhandler I need to determine which cell was selected. I only got the parameter com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent in the event handler method, but I don't know if this is sufficient for what I want.

All help is welcome.

Thanks,

Richard

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 07, 2007 at 02:34 PM

    Richard,

    for each button in the table do the following

    1) Add following parameters to Action associated with button (in addition to wdEvent)

    param1 : type String

    element: type (Node Element of the table node)

    (Now you have 3 parameters in onAction event for buttons)

    2)

    Add the following code in wdDoModifyView

    if(firstTime)
     {
        	IWDButton mybutton1 = (IWDButton)view.getElement("btn1");
    //parameter to know the column of the cell
        	mybutton1.mappingOfOnAction().addParameter("param1", "column1");
    //add an element to know the row number of the cell
    		mybutton1.mappingOfOnAction().addSourceMapping("nodeElement", "element");
    }
    

    3) Now access the parameters added in the onAction event of the button

    wdComponentAPI.getMessageManager().reportSuccess("Button clicked in column: " + param1 + " Row: " + element.index());

    Thanks

    Deepak

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 07, 2007 at 01:23 PM

    Hi Richard,

    wdContext.nodeXX().getleadSelection();

    will give you selected coloumn number.

    Regards,

    Naga

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 07, 2007 at 03:51 PM

    Thanks Deepak ,

    Problem is solved, rewarded points.

    regards,

    Richard

    Add comment
    10|10000 characters needed characters exceeded