Showing posts with label Sorting. Show all posts
Showing posts with label Sorting. Show all posts

Tuesday, October 28, 2014

Resetting ADF table sorting

ADF table sort behaves weird in some cases, like once you do a sort on any column and if you revisit the same screen, the table retains the sorting column in memory for all subsequent querries. If at all we forcefully re-execute the VO then also it retains the sorting.

So to remove sorting execute this piece of code :

    public void resetSort()
        {
            
            SortCriteria[] sc = new SortCriteria[0];
            DCBindingContainer iteratorbinding = this.getBindingContainer();
            if(iteratorbinding != null){
            DCIteratorBinding iter =
                iteratorbinding.findIteratorBinding("SampleVO1Iterator");
            
            iter.applySortCriteria(sc);
            

            }
        }

By doing this you do not need to re-execute the VO also.