Skip to main content

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 

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


Billy Bob Bain said…
This was very helpful!
Keith Reardon said…
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.
Ankur Pradhan said…

I am working af:tree, I need to achieve same functionality for RichTree.

When I tried same approach, I am getting below exception

Caused by: java.lang.IllegalArgumentException: No clientId specified

Code Tried:

RichTree orderTree = this.getOrderTree();
RowKeySetAttributeChange rks = new RowKeySetAttributeChange(orderTree.getClientRowKey(),
"selectedRowKeys", new RowKeySetImpl());
addComponentChange(FacesContext.getCurrentInstance(),orderTree, rks);

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!