In previous post Working with af:iterator and ADF forEach programmatically (Populate values using POJO from Managed Bean) we saw that how can we populate record from a List to af:iterator and af:forEach (ADF Faces Component)
So this post is about adding and deleting of records from List while List is presented using af:iterator.
here I am extending the previous post and using the same sample application
Added two fields and button on the page to add records
and on this button action simply added both attributes to List and added partial trigger of the button to af:iterator to refresh it
On page – add a new record (record added in List and appeared in iterator as well)
So it is quite simple to add records but deletion of a record is a bit tricky but not difficult at all 🙂
Let’s see this-
For deleting the record I have added a delete link inside iterator so that it should appear for each record as you can see in the snap (above)
Here question is that how to know that which record should be deleted?
So for this, I have added a f:attribute tag to link, this attribute contains the value of the current item of the iterator
f:attribute derives its value from var of af:iterator/af:forEach, this var represents each item of List
Now on delete button’s action – get the current item and remove it from List
After deleting records
Sample ADF Application- Download
An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF