[
https://issues.jboss.org/browse/RF-12232?page=com.atlassian.jira.plugin.s...
]
Lukáš Fryč edited comment on RF-12232 at 5/30/12 11:52 AM:
-----------------------------------------------------------
Added support for {{varStatus}}, {{begin}}, {{end}}, {{step}}, so all of the {{c:forEach}}
attributes are currently supported:
http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/forEach.html
However when using them, you require to import {{richfaces-ui-commons}} into the project
(by default for all RichFaces components).
Example:
{code:xml}
<c:forEach items="#{this.collection}" var="item"
begin="1" step="2" varStatus="status">
#{status.isFirst()}
#{item}
</c:forEach>
{code}
was (Author: lfryc):
Added support for {{varStatus}}, {{begin}}, {{end}}, {{step}}, so all of the
{{c:forEach}} attributes are currently supported:
http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/forEach.html
However when using them, you require to import {{richfaces-ui-commons}} into the project
(by default for all RichFaces components).
[CDK] Support "varStatus" attribute on c:forEach
------------------------------------------------
Key: RF-12232
URL:
https://issues.jboss.org/browse/RF-12232
Project: RichFaces
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: cdk
Affects Versions: 4.2.1.Final
Environment: All
Reporter: Paul Dijou
Assignee: Lukáš Fryč
Labels: cdk, richfaces, xp
Fix For: 4.3.0.Milestone1
Right now, when using {{<c:forEach>}} tag on a CDK template.xml, you will have a
"for" loop in Java code. There is no way to do simple logic in the template like
knowing your current index inside the loop, etc...
An idea would be to support the {{varStatus}} attribute from the original
{{<c:forEach>}}. This attribute maps to the name of a bean which contains util
methods and evolve at each iteration of the loop.
Here is a sample:
{code:xml}
<c:forEach var="child" items="#{component.getChildren()}"
varStatus="status">
// Inside code
</c:forEach>
{code}
Would generate something like:
{code:java}
LoopTagStatus status = new LoopTagStatus();
for(UIComponent child : component.getChildren()) {
// Inside code
status.next();
}
{code}
The javadoc of the original {{LoopTagStatus}} from JSTL is
[
here|http://docs.oracle.com/javaee/5/jstl/1.1/docs/api/javax/servlet/jsp/...].
Our LoopTagStatus would have the method and one more : the {{next()}} method. This one
would increment the current index of the LoopTagStatus in order to be updated for the next
iteration.
We could also add any other usefull methods to this bean.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira