Skip to main content
June 1, 2012
Question

CurrentRow MOD And Br

  • June 1, 2012
  • 4 replies
  • 2573 views

hello I'm trying to get a loop. The idea is to just

create a table that shows 2 row and 5 column.

Instead of

1

2

3

4

a.s.o

I want

12345

space writable

678910

I've made a CurrentRow MOD and it working right to left, but

not the space

even if it is possible to loop the table instead of the columns

<table width="500" border="1">

<tr><cfoutput query="testrec" startRow="#StartRow_testrec#" maxRows="#MaxRows_testrec#">

<td>#testrec.tblOnskelista# </td>

<CFIF testrec.CurrentRow MOD 5 IS 0>

</TR>

<TR></TR>

</CFIF>

</cfoutput>

</table>

    This topic has been closed for replies.

    4 replies

    Legend
    June 1, 2012

    I tend to avoid the MOD calculation in a loop like this and instead use two loops:

    <table>
      <cfloop index="variables.i" from="#StartRow_testrec#" to="#EndRow_testrec#" step="5">
       <tr>
        <cfloop index="variables.y" from="#variables.i#" to="#variables.i+5#">
         <td><cfif variables.y LTE testrec.rowCount>#testrec.tblOnskelista[variables.y]#<cfelse> </cfif></td>
        </cfloop>
       </tr>
      </cfloop>
    </table>
    WolfShade
    Legend
    June 1, 2012

    I saw this exact same question on another forum: http://www.codingforums.com/showthread.php?t=263220

    ^_^

    June 1, 2012

    Yes is the same..

    BKBK
    Community Expert
    Community Expert
    June 4, 2012

    Couldn't you just do something as simple as this

    <table width="500" border="1">

    <tr>

    <cfoutput query="testrec" startRow="1" maxRows="5">

    <td>#testrec.tblOnskelista# </td>

    </cfoutput>

    </tr>

    </table>

    <br>

    <table width="500" border="1">

    <tr>

    <cfoutput query="testrec" startRow="6" maxRows="5">

    <td>#testrec.tblOnskelista# </td>

    </cfoutput>

    </tr>

    </table>

    Inspiring
    June 1, 2012

    In the spot where you want your space, add a set of td tags containing a non breaking space.

    Inspiring
    June 1, 2012

    I think you'll find an empty <tr> doesn't - intrinsically - have any height.

    --
    Adam

    June 1, 2012

    Tru....

    that have no funktion and i have remove that. still i can not find how to make space to break it out and make 2 table

    table 1

    1 2 3 4 5

    space

    table 2

    6 7 8 9