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):
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.







4 comments:
Hello Andrejus!
There is still some strange behaviour happening on that demo...
If you select a row and that correspondent checkbox after it works!
But if you directly select the checkbox you need a double click to have it checked... It happens both on parent nodes and on child nodes (tested on Firefox and Chrome).
Does it happen to you too?
Hi,
Nope - this wasnt happening, when I was testing. I using latest JDev 11g.
Andrejus
I have a treetable with checkboxes where the parent and child is one viewobject. Like the employee id and manager id in the employee viewobject. How to uncheck/check all the child based on the parent uncheck/check?
I need to get the data of the tree table rows for which the check boxes are selected in the backing bean? Normal iteration to check 'if the check box is true' is not working.
Post a Comment