2 single selection tables on the same page
I used the following great article:
http://blogs.sun.com/roller/page/winston?entry=single_selectable_row_table_comp onent
to create a singlerow select table. But I want 2 of these tables on the same page of my tabset component.
On my page i have:
private TableSelectPhaseListener tablePhaseListener = new TableSelectPhaseListener();
public void setSelected(Object object) {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
if (rowKey != null) {
tablePhaseListener.setSelected(rowKey, object);
}
}
public Object getSelected(){
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return tablePhaseListener.getSelected(rowKey);
}
public Object getSelectedValue() {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return (rowKey != null) ? rowKey.getRowId() : null;
}
public boolean getSelectedState() {
RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
return tablePhaseListener.isSelected(rowKey);
}
but when I added the second table, I had to add the duplicate the above 4 methods, changing currentRow to currentRow2 and tablePhaseListener to tablePhaseListener2, and changing the method names. I also had to make these updates in 2 other placeson the JSP code, as well as in the JavaScript!! For just 2 tables this isn't too bad, but with more tables having to synchronize everything could get real ugly real fast. Am I doing something wrong?
Also,
It seems to work, however my IE browser is still reporting some minor Javascript errors that I don't get when I had only 1 single-row select table
Thanks,
-DM

