If you want to add selection checkbox to ADF tree, read this post - ADF Tree - How to Add Checkbox. Today I will describe how to implement auto-selection for the same checkbox. Checkbox selection will be calculated using Groovy, based on additional helper attribute.
Download updated sample application - TreeCheckboxApp_v2.zip. This sample is extended with additional helper attribute on EO level, for Regions and Countries EOs. This is transient String type attribute - RegionConfirmedStatus for Regions EO:
RegionConfirmed boolean attribute value is calculated trough Groovy, based on RegionConfirmedStatus character value - Y = true, else = false. This is required, otherwise boolean value is not changed directly. It works well, when value is calculated from Groovy:
Same for Countries EO - CountryConfirmed attribute:
On UI, ADF UI component - selectBooleanCheckbox, should be configured with value change listener and enabled with auto submit - this allows to catch checkbox change event:
Value change listener is not changing boolean value directly, but is changing only helper attribute value (Y/N). When change is performed, Groovy is fired on EO level and recalculates main boolean attribute value used for checkbox. If we would change boolean value directly, this value is not preserved and is reset back to original value during next refresh. Helper attribute value is changed for Regions level as well as for Countries level (iterating over detail collection):
Implemented functionality - user selects top level node - dependent child nodes are auto-selected (and opposite on deselect):
Download updated sample application - TreeCheckboxApp_v2.zip. This sample is extended with additional helper attribute on EO level, for Regions and Countries EOs. This is transient String type attribute - RegionConfirmedStatus for Regions EO:
RegionConfirmed boolean attribute value is calculated trough Groovy, based on RegionConfirmedStatus character value - Y = true, else = false. This is required, otherwise boolean value is not changed directly. It works well, when value is calculated from Groovy:
Same for Countries EO - CountryConfirmed attribute:
On UI, ADF UI component - selectBooleanCheckbox, should be configured with value change listener and enabled with auto submit - this allows to catch checkbox change event:
Value change listener is not changing boolean value directly, but is changing only helper attribute value (Y/N). When change is performed, Groovy is fired on EO level and recalculates main boolean attribute value used for checkbox. If we would change boolean value directly, this value is not preserved and is reset back to original value during next refresh. Helper attribute value is changed for Regions level as well as for Countries level (iterating over detail collection):
Implemented functionality - user selects top level node - dependent child nodes are auto-selected (and opposite on deselect):
16 comments:
i need a tutor for this step by step T_T
Yes, we are doing trainings as well. Please log training request on http://redsamoracle.wikispaces.com or drop me email.
Andrejus
Is it possible to have regionconfirmed and countryconfirmed as database columns(not transit)
Marko
Yes, then it should be even easier to implement.
Andrejus
I have problem with auto refresh, when I trigger it manualy I see the columns are updated correctly, so bean works
OK I solved autorefresh, now I would need to try one more level (for example department)
I have country-location-department tree
, tree works I only don't know how to autoselect all departments in specific location (autoselect from second level)
Tried like this, but I get null value along the way
DCIteratorBinding dcIb = ADFUtils.findIterator("CountryView1Iterator");
CountryViewRowImpl country = (CountryViewRowImpl)dcIb.getCurrentRow();
RowIterator ri = country.getLocationView();
LocationViewRowImpl location = (LocationViewRowImpl)ri.getCurrentRow();
RowIterator riloc = location.getDepartmentView();
Batimba
Hello Andrejus!
Unfortunately the sample is not working anymore on JDev 11gR2... I tried to implement my own checkbox implementation but did not work, the behavior is that, when you select one checkbox, another one gets deselected and that keeps going... It happens to all checkbox implementations on TreeTable's within JDev 11gR2...
Tested with your sample and with my own implementation =/
PS: You have a really hard captcha!!! Tried around twenty times before posting successed
Okej, I will test it and check for workaround solution.
Andrejus
Hi,
I have tested - indeed it didnt worked on new release.
But I fixed it and found working solution. I will post update on the blog.
Andrejus
Hello Andrejus,
Thanks for you help! I'll be waiting.
Regards,
Renan.
Hi,
I have posted updated sample app: http://andrejusb.blogspot.com/2012/11/check-box-support-in-adf-tree-table.html
Andrejus
I have a requirement where we have to display around 10 checkboxes on a page. Based on the checkboxes selected, we need to display the text of those checkboxes in the format of a table. So, can you please help.
Thanks
Srikala
Hi Andrejus,
Could you please provide this sample APP as this link is not working.
Thanks,
Sumit
All old sample are available on Google Archive - https://code.google.com/archive/p/jdevsamples/downloads
Andrejus
Can I represent selected and unselected values in the form of images/icons !
Meaning when the checkbox is selected we display a certain icon (not the usual tickmark) and on unselecting another icon
I have a pop where their are list of checkBoxes. I have to autoselect one checkbox if certain condition occurs and send an email . Check boxes reside inside the POP-Up and I am not able to select the checkbox based on valueChangeEvent and doubtful how to implement it as the checkboxes resides inside pop-up.
Post a Comment