Clearing ADF Faces Table row section when change persistence is ON

Clearing af:table row section when change persistence is ON involves two steps:

1. Clearing the selected rows using table API
2. Call the change manager API to replace the current change persistence with an empty set

 Here is the code snippet for the above tasks:

public void clearRowSelection(RichTable table) {
    //Clearing the selected rows using table API 
    table.getSelectedRowKeys().clear();

    //Call change manager API to replace the
    //current change persistence with an empty set 
    RowKeySetAttributeChange rks =    new RowKeySetAttributeChange
        (table.getClientId(), 
            "selectedRowKeys", new RowKeySetImpl());
    RequestContext.getCurrentInstance().getChangeManager().
        addComponentChange(FacesContext.getCurrentInstance(),table, rks);
}

Comments

  1. 2 questions for you, 1) does this same code apply for af:treeTable, I hope so as we have this problem with af:treeTable, and 2) is there something similar to clear the disclosed row keys in af:treeTable as they also appear to be persisted and that interferes with logic to programmatically set disclosed rows.

    ReplyDelete

Post a Comment