Sunday, January 6, 2013

ADF: Default Detail, Only One Detail Row can have the default flag set



     1. Create ADF BC components and setup the AM Datamodel for master detail. From the data control panel drop the detail as Master Form and Detail Table.



      2.       Drop the Preferred Flas as a Single Selection Column, Boolean Checkbox on the detail table. Choose the selected and unselected values for the checkbox.







       3.       Edit the properties of the Checkbox, add auto submit to true and set partial trigger on the detail table to the checkbox. Add a value change listener and bind it to a bean proeperty.


        4.       Add logic in value change listener to update all other rows when a new default row is selected.



       5.       Run the application and select a new default row, you can observe that the other default row already selected is cleared.


You can download the complete application here.

1 comment:

  1. You can change code (step 4):
    if (newVal!=null && newVal instanceof Boolean && (Boolean)newVal)
    to
    if (Boolean.TRUE.equals(newVal))

    it'll do the same :)

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...