[MAGNOLIA-1505] contentNodeIterator varStatus.index does not start from 0 Created: 03/May/07  Updated: 23/Jan/13  Resolved: 24/Oct/07

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 3.5 RC1

Type: Bug Priority: Major
Reporter: zam6ak Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-473 contentNodeIterator: begin, end, step... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

varStatus.index in contentNodeIterator should start from 0 and not from 1.



 Comments   
Comment by zam6ak [ 03/May/07 ]

Also, varStatus.count is reporting wrong value.

if contentNodeIterator was supposed to follow JSTL forEach tag specs then varStatus definatelly does not behave as in forEach.
Here is what varStatus should provide:

Table 2. Properties of the LoopTagStatus object
Property Getter Description
current getCurrent() The item (from the collection) for the current round of iteration
index getIndex() The zero-based index for the current round of iteration
count getCount() The one-based count for the current round of iteration
first isFirst() Flag indicating whether the current round is the first pass through the iteration
last isLast() Flag indicating whether the current round is the last pass through the iteration
begin getBegin() The value of the begin attribute
end getEnd() The value of the end attribute
step getStep() The value of the step attribute

Now, the million dollar question.....What does contentNodeIterator provides that JSTL's forEach couldn't ???
Yes, it is convenient because it sets the node for use in other tags (like <cms:includeTemplate />) but you should be able to set the node inside forEach and apply that node to other tags...

Comment by Sean McMains [ 04/May/07 ]

This also seems to be affecting varStatus.last, which reports "true" one iteration before it should.

Comment by Fabrizio Giustina [ 24/Oct/07 ]

status, first and last now works as expected. Count is right only when not using start/step, we should probably fix it while looking at MAGNOLIA-473

Generated at Mon Feb 12 03:27:34 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.