cancel
Showing results for 
Search instead for 
Did you mean: 

Determine selected cell in table with buttons

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Deepak ,

Problem is solved, rewarded points.

regards,

Richard

Former Member
0 Kudos

Hi Richard,

wdContext.nodeXX().getleadSelection();

will give you selected coloumn number.

Regards,

Naga