Nov 18, 2011

ADF-UI: Custom ADF table filter (query by example) using af:selectManyChoice

Today I will explain how you can add custom table filter using <af:selectManyChoice>. This type of filter has already been explained using <af:selectOneChoice> at Custom ADF Filter with drop down. This example will extend this blog post by allowing to select multiple items in the drop down filter.



Download Sample Applicaton : JDeveloper 11.1.1.4

1. Create Application and business components.


2. Setup application module instances.


3. Create a JSF page with table to display EmployeeVO data.


4. Add the following JavaScript to execute the filter query when the selection changes inside <af:selectManyChoice>.


NOTE: To enable AdfLogger in JavaScript, you need to add the following context-param in web.xml. You can read more about this at Oracle AdfLogger. The log will appear in browser console (F12 Developer Tools for ID, FireBug for Firefox)

     <context-param>
          <description>JavaScript Logging</description>
          <param-name>oracle.adf.view.rich.LOGGER_LEVEL</param-name>
          <param-value>OFF</param-value>
     </context-param>

5. Create iterator and tree binding for Job1 view object inside page definition.



 6. Add custom <af:selectManyChoice> inside "filter" facet of JobId column.


7. Add <af:clientListener> to invoke on "valueChange" event.


The "~" at the beginning and end of "#{row.JobId}" is there as delimiter in case if the JobId contains ",".

8. <af:selectManyChoice> will send the selected values as an array so you have to override the following method under EmployeeVOImpl to generate custom clause using "IN" operator.


Run the application:




Enjoy :)

8 comments:

Deb said...

Hey I am doing a sample application which is sort of a CMS... where one post can be assigned to multiple categories.
I wanted to get an idea on how to use MultiSelect to choose 2 or more categories while creating a NewInsert for creating a new Post.
The DB schema is such that there is a separate category table where the post ids are mapped with the category ids so that multiple categories can be assigned.
It will be a great help if you can provide an idea or any links to any tutorial explaining using CreateInsert along with selectManyChoice.
Thanks

Unknown said...

Write a value change listener for selectManyChoice. In that get the current selected values and create the record in the DB for each of the selected items. for deletion compare it with old value and remove the records that are not present in the new values.

Pradip said...

Very good one.. Need to try this

Aparna said...

I was read your all posts and This post is having the valuable content. I am waiting for your next posts, keeping the good work...
Oracle DBA Training in Chennai
best oracle dba training in chennai
Spark Training in Chennai
Oracle Training in Chennai
Social Media Marketing Courses in Chennai
Pega Training in Chennai
Linux Training in Chennai
Primavera Training in Chennai
Tableau Training in Chennai
Oracle DBA Training Fess in Chennai

Revathi said...

It's very useful blog post with inforamtive and insightful content and i had good experience with this information.keep it up!!

android training in chennai

android online training in chennai

android training in bangalore

android training in hyderabad

android Training in coimbatore

android training

android online training

bashaface said...

Casinos: 21+ Only | Casino Roll
Casino Roll was founded in baoji titanium 1998 골인 벳 먹튀 and quickly expanded into 라이브스코어 the next generation of online 하랑 도메인 casino gaming. Our gaming experience is fully researched,  Rating: 3 라이브스코어 · ‎Review by Casino Roll

Unknown said...

Casinos in the UK - How to find good games - GrizzGo
So, what do we https://octcasino.com/ mean by “casinos gri-go.com in the UK”? ventureberg.com/ to https://febcasino.com/review/merit-casino/ find a casino and live casino games on a mobile 토토사이트 phone device in 2021.

Anonymous said...

Compare their RTPs with those of the non-progressive video games above and you will 빅카지노 see why enjoying in} for a jackpot is not all the time greatest choice|the solely option|your greatest option}. The slots with one of the best odds are the video games with the highest Return to Player . While have the ability to|you presumably can}'t certain to|make positive to|remember to} win at these slots each time you play and you can't inform when these slot machines are ready to hit, these are those with one of the best slot machine odds.