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
这篇博客介绍了如何在Java环境下为表格添加单选钮列,并设置相关属性,如name、selectID和onclick。通过示例代码展示了如何实现选中状态的绑定,包括selected、selectedValue和selectedState的同步。此外,还提供了获取和设置选中项的方法。整个过程涉及到了前端界面和后端数据的交互,以及表格组件的操作。

被折叠的 条评论
为什么被折叠?



