Creater中选择一行的方法

1.  在表布局中增加一单选钮列,给单选钮的属性name任意设定一个值。
2.  选择单选钮对应列,将其selectID设为单选钮的ID;将onclick设为setTimeout('initAllRows()', 0)
3.  拷贝如下代码到对应的Page.java中    
    

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);
    }

 


    加入以上代码之后,会在导航栏中出现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

posted @ 2017-01-04 13:47  风来风往风伤(TiAmo)  阅读(196)  评论(0编辑  收藏  举报