Skip to Content

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

Lost Variable: please return to owner.....

Hi,

I am having a problem passing data between jsp pages.

My first JSP page contains a table view (5 lines visible data) which uses the onCellClick event to pass data throught on a second jsp page.

However if I page down in the table and then trigger then onCellClick event (say by clicking on line 7) when I get to the second page the data I see is for line 2 (i.e. as if I had never paged down.

My code for the navigation event and onCellClick is shown below...

I have printed out the value of the method getVisibleFirstRow on the first (calling) jsp and it is updated correctly, but when I print it out on the jsp it is always equal to 1.

Any ideas would be appreciated..

Many Thanks.

public void onMyOnNavigate(Event event) throws PageException {

TableNavigationEvent tne = (TableNavigationEvent) event;

if (myBean != null) {

myBean.setVisibleFirstRow(new Integer(tne.getFirstVisibleRowAfter()).toString());

}

}

public void onMyOnCellClick(Event event) throws PageException {

TableCellClickEvent tcce = (TableCellClickEvent) event;

myBean.setClickedCell(tcce.getVisibleRowIndex(), tcce.getVisibleColIndex());

int realSelectedRow = tcce.getVisibleRowIndex() + Integer.parseInt(myBean.getVisibleFirstRow()) - 1;

int realSelectedColumn = tcce.getVisibleColIndex();

myBean.setClickedCellData(myBean.getModel().getValueAt(realSelectedRow, realSelectedColumn).toString());

display = NEXT;

}

Former Member
Former Member replied

I also had trouble with this, but got it to work. One thing you should verify is if the method onMyOnNavigate is actually getting called when you navigate. I did it a little differently. I didn't try to keep track of the visible first row in a bean. I went directly to the TableView to get that value. As follows:

TableCellClickEvent tcce = (TableCellClickEvent) event;
TableViewEventData tved = (TableViewEventData) tcce.getModifierData();
TableView tableView = (TableView) this.getComponentByName("table");
int row = tableView.getVisibleFirstRow() + tved.getRow() - 1;

tved.getRow() will give you the selected row. In your example that would be 2. First visible row would be 5. So row will be 7.

Brian

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