I'm working with quite a large array of items in a cfloop. I would like to pare this down and add pagination. Is there anyway in my cfloop to limit the array to the first 10?
I have
<cfloop array="#qryItems#" index="index">
I have tried turning it into a condition loop with no luck and a few other things. I haven't touched coldfusion in a while and am a little rusty. Google is not helping haha
I have tried
<cfloop from="1" to="10" array="#qryItems#" index="index">
and have also tried max_rows
<cfloop maxrows="10" array="#qryItems#" index="index">
each time I get the error message
"Attribute validation error for tag CFLOOP."
There is no combination of attributes for
cfloop
to accomplish what your expecting. As BKBK suggested, you'll need to use afrom/to
loop to output a select group of records. If I understand your requirements correctly, I would update yourcfloop
with a new index variable as well, and then set the old variable by referencing the array element.The two
cfloops
below output the same data, with the second displaying only the records in the pagination range.