Friday, 29 September 2017

Dynamically reset af:table filter in Oracle ADF

Introduction: ADF Faces tables can be created with a default table filter for users to further filter the result set of a query, which can be in memory or including re-querying the database. By default, table filters are shown as input text fields with no restriction on what users can type in as a filter pattern.
Now let us type some valid value in the filter and search for it in the table. We will be able to see the corresponding filtered data. Now, if we want to clear the filtered data, we manually have to clear all the text from the filter and hit enter.
Here in this post, we will be demonstrating the case where we will be clearing the filtered data by one click of a Clear Filter Icon as shown below.
For solution of the above requirement follow the steps as shown below:
Step 1: Create an Oracle ADF Fusion Web Application named as ClearTableFilterDemo.
Step 2: Create an ADF Business components from tables (CountriesEO, CountriesVO and AppModule) from the Countries table present in the HR schema of the Oracle Database XE 11g.
Step 3: Create a demo.jspx page. Drag and drop CountriesVO1 from the Data Control as an ADF Read only table Please select Row Selection as Single Row and Check Enable Sorting and Enable Filtering as shown below.
Step 4: Select any column say CountryId column and set rowHeader="true". This will display the Clear Filter Icon on the header of the CountryId column and this will do the resetting of the table filter.
Save All and Run the application. Thus, the ran application is shown below.
Filter table with the RegionId as 2 as shown below.
Click on the Clear Table Filter Icon and this will reset the table filter as shown below.
Hence, the solution to our requirement.
If you like the post, please comment, share the post and do like me on Facebook.

Thanks & Regards,
Susanto Paul

No comments :

Post a Comment