Wednesday, April 13, 2016

Best Practice to Iterate on Client-Side by using ADF

- How can we create an iterator in client side inside ADF?
 
we can make iterator on client side inside ADF by using <af:iterator> or <af:forecah>

- Best Practice:-
                        It is better to use the <af:iterator> instead of the <af:forEach> becaues of the following.


  • This will ensure unique IDs for the created childs.
  • <af:foreach> is not working with JSF dataModel.
  • <af:foreach> cannot be bound bound to EL expressions that use component-managed EL variables (such as the "var" variable on an <af:table>.
  • As the forEach tag is a replacement for the JSTL <c:forEach> tag, it is advisable and easier to go for the af:iterator in most of the cases for a safer ADF support.
  • The forEach tag should be used with intent and knowledge. The forEach tag is not used in JSF for iteration, but instead for generating multiple components. If your goal is to iterate over a collection of objects and render HTML for each item, <af:iterator> should be using instead.


References:-

    http://adfdiary.blogspot.com.eg/2014/03/difference-between-afforeach-and.html



Best Regards

Mohamed Fathy