سؤال

I have a two ADF faces table say A and B and their rowSelection property is is set to "single". Now the requirement is when one row is selected from A , it should clear out all selections from B and vice versa . So I have registered selectionListeners on both the tables and the code that gets executed inside that method is doing the following for the table that has not been selected :

tablenNotSelected.setSelectedRowKeys(null);

What am I missing here ?

هل كانت مفيدة؟

المحلول

You likely need to setup the partial triggers on the table, or possibly the surrounding container, to actually force a screen update.

نصائح أخرى

Don't set the selected row keys to null. Instead use the getSelectedRowKeys().RemoveAll(); API.

To get the other table refreshed do the following.

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

Similar for table 2 listener

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);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top