清除 af:table 上的选择的 api 是什么



我有两个ADF面表,说AB,它们的rowSelection属性设置为"single"。现在的要求是当从A中选择一行时,它应该清除B中的所有选择,反之亦然。所以我在两个表上都注册了selectionListeners,并且在该方法中执行的代码正在为尚未选择的表执行以下操作:

tablenNotSelected.setSelectedRowKeys(null);

我在这里错过了什么?

您可能需要在表或周围的容器上设置部分触发器,以实际强制屏幕更新。

不要将选定的行键设置为 null。请改用getSelectedRowKeys().RemoveAll(); API。

要刷新另一个表,请执行以下操作。

table_1_selectionListener() {
    RequestContext.getCurrentInstance().addPartialTarget(T2);
}

与表 2 侦听器类似

public void clearTableSelection(RichTable table) {
    table.getSelectedRowKeys().clear();
    RowKeySetAttributeChange rks = new RowKeySetAttributeChange(table.getClientId(), "selectedRowKeys", new RowKeySetImpl());
    RequestContext.getCurrentInstance().getChangeManager().addComponentChange(FacesContext.getCurrentInstance(),table, rks);
    AdfFacesContext.getCurrentInstance().addPartialTarget(table);
}

相关内容

最新更新