Filtering Modified Rows in ADF View Object

Some times we need to identify modified or new rows programmatically and determine row status, to be more clear for users.

2

I have developed this sample application –FilterModifiedRows.zip.

in ADF (12.2.1.2.0).

Initially we need to customize default selection in table to get selected row key and add it in java Map if it is not already existed.

Note that keys stored in Map with null values:

3

And also customize default creation action to create new row and get selected row key and add it in SelectedRows Map if it is not already existed:

4

Then, We need to check status for each row in view object to identify whether status is New or Modified. by invoking checkRows method which iterate over selectedRows Map elements and update elements values and increment counters:

5

We have to customize Commit, Rollback actions to commit or rollback changes and reset selectedRows Map and counters:

6

7

Remember to remove SelectedRowKeys property from table.

Finally we can write following expression in inline style of column of table, so that it can check all rows in table and differentiate between different status:

8

You can see  rows are highlighted by orange color after modifying, and highlighted by blue color after create new row. This informs user that he did changes in the table.

1

Update Data in Auto Commit ADF Table

Some times we need to save changes automatically, to avoid any corruption or connection down, so we need to implement auto saving.

I have developed sample application –AutoCommitTable.zip.

in ADF (12.2.1.2.0).

1

We need to check status of transaction, initially the transaction is not dirty (data is not changed). then if user changes any data the status is modified to “Modified”.

States are set to one of these values:

STATUS_INITIALIZED, STATUS_NEW, STATUS_MODIFIED, STATUS_DELETED and STATUS_DEAD.

In this example, user changes phone number to 123451, then just navigates to another row without saving, and changes will be saved automatically.

2
I will describe how it is implemented, You need to customize default behavior of Selection Listener for the table, You can determine unsaved changes with check if the data control transaction is Dirty, then invoke Commit operation:

4

And the util methods to evaluate and invoke default selection listener, to make selected row as current row:

5

6

we can check database to confirm changes are saved.

3