1. 在表布局中增加一单选钮列,给单选钮的属性name任意设定一个值。
2. 选择单选钮对应列,将其selectID设为单选钮的ID;将onclick设为setTimeout('initAllRows()', 0)
3. 拷贝如下代码到对应的Page.java中
private TableSelectPhaseListener tablePhaseListener = newTableSelectPhaseListener();public voidsetSelected(Object object) {
RowKey rowKey= (RowKey)getValue("#{currentRow.tableRow}");if (rowKey != null) {
tablePhaseListener.setSelected(rowKey, object);
}
}publicObject getSelected(){
RowKey rowKey= (RowKey)getValue("#{currentRow.tableRow}");returntablePhaseListener.getSelected(rowKey);
}publicObject getSelectedValue() {
RowKey rowKey= (RowKey)getValue("#{currentRow.tableRow}");return (rowKey != null) ? rowKey.getRowId() : null;
}public booleangetSelectedState() {
RowKey rowKey= (RowKey)getValue("#{currentRow.tableRow}");returntablePhaseListener.isSelected(rowKey);
}
加入以上代码之后,会在导航栏中出现selected、selectedValue、selectedState三个选项。
4. 选择单选钮,将其属性selected和selectedValue与导航栏中出现的selected、selectedValue对应绑定。
5. 选择表的tableRowGroup,将其属性selected设为导航栏中出现的selectedState。
/
RowKey[] rk = this.tableRowGroup.getSelectedRowKeys();
String v= this.personDataProvider.getValue("字段", rk[0]).toString();
之前所写,迁移至此
原文链接:http://user.qzone.qq.com/372806800/blog/1336195536