Skip to Content
author's profile photo Former Member
Former Member

Using OnCellClick with TablView to get cell value

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 10, 2005 at 03:16 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2005 at 04:28 PM

    Many Thanks,

    That works great! 😊

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.