Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question