cancel
Showing results for 
Search instead for 
Did you mean: 

How to use onRowSelection !!!!

Former Member
0 Kudos

Hi,

very new to EP and I Was working on tableviews where had mentioned the onRowSelection event can anyone tell me how to work with this event and also how to get data of the selected row, i need to know this very badly, so plz can anyone help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

There are some good examples in EP(User Interface Development->HTMLB->Additional Examples using Models->tableView).

I think you could do something like that:


public void onMyOnRowSelection(Event event) throws PageException {
		TableRowSelectionEvent r = (TableRowSelectionEvent)event;		
		int realSelectedRow = r.getVisibleRowIndex() + Integer.parseInt(myBean.getVisibleRow()) - 1;	
String valueForCol1 = myBean.getModel().getValueAt(realSelectedRow, 1).toString();
}

"myBean" is your TableViewBean. There you can set the visible at the NavigationEvents... you can see this in the examples...

Best Regards,

Christian

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you have to define the method, which will be started, when the event occured:

myTableView.setOnRowSelection("onRowSelection");

In the Main-Class you have to implement this method like:

public void onRowSelection (Event event) {

TableView table = (TableView) this.getComponentByName("myTableView");

}

Regards,

Gerhard

Former Member
0 Kudos

Hello,

I implemented this a long time ago so I'll do my best:


TableView table = (TableView) this.getComponentByName("backenTV");
int ns = 0;

			
for (int i = 1; i <= table.getRowCount(); i++) {
   if ((table.isRowSelected(i))) {
	ns = i;
    }
}

After this You can read out the line of the TableViewModel an access the values.

Good luck and try it.

Walter