Browse Category by filter
View Post

ADF: af:table filter modifications using a custom Query Listener

In one of our last projects we had the requirement to allow the user to filter tables using the table filter feature. By default you can filter String fields starting with the word that the user provides, but our customer needed to find the rows that contained the criteria.

This is an easy task that can be accomplished by creating a custom Query Listener method.

As by default the filter works with “Starts with” condition you will see that filtering by “tra” will give no result although departments like Administration exists.
In this example we will use Departments table in HR schema.

When we drag and drop to create a table and we set it to be filterable, we can see that a query listener has been created by default.

As we need to modify the filter values we need to create ouor own query listener.
The idea of this method is to get every value, and if it is String we have to change the original value and concatenate ‘%’ before and after the value.
After that we need to call the default query listener that we can get from queryListener property in the table component.
If we end here, the  user would see the new filter with % symbol, so we are going to remove it and leave it as the user type it.

This is the helper method we use to call the default  query listener.

The last step is to set our new method as the table’s query listener.

If we run the application we can see that if we filter by “tra”, we can now see some records.

ADF: Filtering parent and child nodes in af:tree / af:treeTable

One of our customers required to filter data in a page with a tree component. Using Ashish’s post I am going to show you how to filter both parent and child nodes having just a single filter value. This can also be applied to treeTable component.

The first thing we need is a tree component and data structure, in this case we are going to use Oracle’s hr schema tables: Departments and Employees.

In our page we drag and drop DepartmentsView from datacontrols palette and create a tree component.

The next thing we have to do is to create a View Criteria in Departments View Object (parent).

We also have to crete a View Criteria in Employees View Object (child).

We have to expose setter method of the bind variable in parent View Object.
As we exposed the bind variable in parent, we need  to pass that value to the child by overriding createViewLinkAccessorRS method in parent View Object Implementation class (

The last step in the Model is to set a default View Criteria in parent View Object. To set it we have to right click on the View Object instance in our AppModule, click on ‘Edit’, select the View Criteria and click on ‘Ok’ button.

The Model is now finished, we now have to drag and drop the setter method from the data controls palette and create an ‘ADF Parameter Form’ so we can provide the filter value.

This will create ‘setsearchValue’ method binding in the pageDef. We also need to create a Execute operation of the parent View Object and call both operations from the ‘Filter’ button ActionListener.

This is how we should have the page.

If we run the application we can see the if we filter by ‘pat’ we just get values that contains that string.

If now we filter by ‘les’, we can see that we get values with ‘les’ string in both parent and child nodes.

ADF: Switching between skins on runtime based on the url

Andrejus posted a couple of months ago how to switch between alta and skyros in ADF 12c. This is a cool way to start the migration from 11g to 12c and Alta UI. I am going to show you another way to use one skin or other based on the page you are.

Firstly we have to create a bean and a property inside it where we are going to store the current skin. We have to set this bean as sessionBean.

After that we have to set a bean property in skin-family in our trinidad-config so we can set the skin dynamicaly.

The next step is to create a filter. In doFilter we are going to evaluate the URL and set the skin based on that value. We also have to instantiate the bean and add it to sessionScope becasuse the first time it will be null.

Once we have the filter created we have to add it to web.xml

Now that we have all setup, having multiple pages, if we test it we can see that the the page “alta” will display AltaUI skin and “skyros” page wil dispklay Skyros skin,