cancel
Showing results for 
Search instead for 
Did you mean: 

Using OnCellClick with TablView to get cell value

Former Member
0 Kudos

Hi,

I have created an iView with a Table View in it. I've also created an onCellClick event successfully raises the event in my Java Code.

How in my code do I get the value of cell that has been clicked?

I've read through the documentation but can't find a reference to how this particular operation is done?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi KR,

this is part of the documentation!

// CALLED IF THE USER CLICKED IN ONE CELL OF THE TABLEVIEW
public void onCellClick(Event event) {
  // get the event
  TableCellClickEvent tcce = (TableCellClickEvent) event; // get the event
  // get the coordinates for the clicked cell and store it in the bean
  myBean.setClickedCell(tcce.getVisibleRowIndex(), tcce.getVisibleColIndex());
  // calculate the position in the table. The values returned above are "absolut" to the visible
  // cells. The first visible row is available in the bean. So the value of the first
  // visible row is added.
  int realSelectedRow = tcce.getVisibleRowIndex() + Integer.parseInt(myBean.getVisibleRow()) - 1;
  int realSelectedColumn = tcce.getVisibleColIndex();
  // Store the cell position in the bean. This information is displayed as textView under the tableView in the JSP
  myBean.setClickedCellData(myBean.getModel().getValueAt(realSelectedRow, realSelectedColumn).toString());
}

But you're not the only one who does not find it See https://forums.sdn.sap.com/thread.jspa?threadID=11304

Hope it helps

Detlev

Answers (1)

Answers (1)

Former Member
0 Kudos

Many Thanks,

That works great!