Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
I think you'll find an empty <tr> doesn't - intrinsically - have any height.
--
Adam
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
In the spot where you want your space, add a set of td tags containing a non breaking space.
Copy link to clipboard
Copied
I saw this exact same question on another forum: http://www.codingforums.com/showthread.php?t=263220
^_^
Copy link to clipboard
Copied
Yes is the same..
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
i get wront when i start next 10 record
<a href="<cfoutput>#CurrentPage#?PageNum_testrec=#Min(IncrementValue(PageNum_testrec),TotalPages_testrec)##QueryString_testrec#</cfoutput>">Next</a>
now you say only the first 10
Copy link to clipboard
Copied
Kalle4001 wrote:
i get wront when i start next 10 record
<a href="<cfoutput>#CurrentPage#?PageNum_testrec=#Min(IncrementValue(Pag eNum_testrec),TotalPages_testrec)##QueryString_testrec#</cfoutput>">Ne xt</a>
now you say only the first 10
This is apparently a new question. Have you resolved the first one?
Copy link to clipboard
Copied
I've managed to get to the first part. the problem is if it is not 10 record when it can not display it, which gets a little problem at page
Copy link to clipboard
Copied
You can just add if-conditions to control output according to the number of records. Here are examples:
(1)
<cfif testrec.recordcount GTE 1>
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="1" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
</cfif>
<br>
<cfif testrec.recordcount GTE 6>
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="6" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
</cfif>
(2)
<cfif testrec.recordcount GTE 11>
<cfoutput query="testrec" startRow="11" maxRows="8">
<cfset link = CurrentPage & "?PageNum_testrec=" & Min(IncrementValue(PageNum_testrec),TotalPages_testrec) & QueryString_testrec>
<a href="#link#">Next</a><br>
</cfoutput>
</cfif>
Copy link to clipboard
Copied
the code get following error
Element RECORDCOUNT is undefined in TESTREC.
Copy link to clipboard
Copied
I am assuming that your query is called testrec.
Copy link to clipboard
Copied
yes.. my query is called testrec
Copy link to clipboard
Copied
Then testrec.recordcount should exist! Make sure you put the above code in a position where the query is defined. For example, right after the cfquery tag.
Copy link to clipboard
Copied
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> |