Skip to content

View Helpers

resetCycle()

resetCycle() — returns void

Available in: controller Category: Miscellaneous Functions

Rsets a named cycle, allowing it to start from the first value the next time it is called. In Wheels, cycle() is often used to alternate values in a repeated pattern, such as CSS classes for table rows, positions, or emphasis levels. By calling resetCycle(), you ensure that the cycle begins again from its initial value, which is useful when looping through nested structures or when a new grouping starts.

NameTypeRequiredDefaultDescription
namestringnodefaultThe name of the cycle to reset.
// alternating row colors and shrinking emphasis
<cfoutput query="employees" group="departmentId">
	<div class="#cycle(values="even,odd", name="row")#">
		<ul>
			<cfoutput>
				rank = cycle(values="president,vice-president,director,manager,specialist,intern", name="position")>
				<li class="#rank#">#categories.categoryName#</li>
				resetCycle("emphasis")>
			</cfoutput>
		</ul>
	</div>
</cfoutput>