Showing posts with label Checkbox. Show all posts
Showing posts with label Checkbox. Show all posts

Sunday, April 27, 2014

Check Box Support in ADF Query (11g R2 and 12c)

Few years passed since my previous post about check box support in ADF Query - Yes-No Check Box in Query Criteria. It was not working before, but there are improvements in the latest ADF releases. I will describe approach to handle multiple values from the same column, using check box in ADF Query. By default, you could render multiple values with choice list - but there is a way to use a group of choice lists (when column values will be known in advance).

Sample application - ADFQueryCheckboxApp.zip, implements ADF Query with a criteria to search by employee status. This status could be of three types - internal, external and consultant. All three check boxes are rendered in ADF Query, under Status group (check box with Internal status is ticked by default):


You could tick External in addition and bring both Internal and External employees:


Tick External and Consultant - this will bring different results:


Status for Internal, External and Consultant is set through Status field in Employee table:


As you can see, status is encoded through I, E and C values accordingly. This would mean, I would need to define three attributes in the VO, pointing to the same column in DB. Each attribute should handle different status. I would need to have LOV VO, to to define a check box. In order to simplify it and avoid creating three different VO's for each attribute LOV - I'm going to create only one VO with bind variable. This SQL query would always return bind variable value back - this is what I'm going to control through View Accessor:


We are done with LOV VO. There are three attributes defined in VO, based on the same EO attribute. Each attribute for different status:


Make sure to set attribute Control Type to be Check Box, before defining LOV. I'm using UI Category - EmployeeStatys, to group attributes in ADF Query:


Each status attribute is assigned with LOV. Keep in mind - each LOV is configured through different View Accessor (this is needed to pass a proper bind variable, based on a status represented by the attribute):


Here you can see an example - 'E' external flag variable is configured for View Accessor used in LOV configured for External employee status attribute:


UI groupings visible in ADF Query UI, are configured through UI Categories section in VO:


Check box for Internal status was ticked, using default value in View Criteria - 'I':

Sunday, November 18, 2012

Check Box Support in ADF Tree Table Different Levels

Year ago I had a blog post about workaround to render check box in ADF tree table - ADF Tree - How to Autoselect/Deselect Checkbox. This was implemented with previous JDeveloper 11g R1 PS4 version. However, there is no need to have described workaround anymore, check box and ADF tree table combination works much better in JDeveloper 11g R2 version - 11.1.2.3.0. Based on blog reader request, I will post today updated sample application - TreeCheckboxApp_v3.zip.

Both entities - Regions and Countries have special attribute of Boolean type, this attribute will be rendered as check box in ADF UI tree table component. There is no need to have helper attribute as we had before. Regions entity:


Countries entity:


Once Regions check box is checked - all Countries are checked (and vice versa). We can control this from managed bean - listening for value change event in Regions and resetting Countries:


On ADF UI side, in order to be able to render proper tree table structure with check boxes - don't forget to set rendered expression, we want to render check box only for such rows, where check box value is not Null:


Take a look how it is displayed on UI. China is selected, from Asia group:



Select Asia check box - all countries from Asia will get selected automatically (thanks to managed bean method we have implemented above):


Uncheck Asia check box - all dependent check boxes are unchecked:


While Region check box is checked, you can uncheck/check Countries check box as well. This is one of the most typical use cases for check box support in ADF tree table.