Copy link to clipboard
Copied
Could anyone tell me if it is possible do paging inside cflayout tabs. I tried but without any success. I have a master file contain cflayout with tabs, and each tab is a unique file display query results. What I want to accomplish is to have multiple pages in each tab base on recordsets. When I use the traditional PREVIOUS and NEXT link to do it, I lost the tabs and become a independent file.I could not figure how how to keep it maintain in its tab. If I really keep the tabs structure, is it still possible to do the paging in each tab? By the way, I am using CF8.
Thanks,
Jush
<cflayout type="tab">
<cflayoutarea title="Dynamic1" source="/dynamic1.cfm" refreshOnActivate="true" />
<cflayoutarea title="Dynamic2" source="/dynamic2.cfm" refreshOnActivate="true" />
<cflayoutarea title="Dynamic3" source="/dynamic3.cfm" refreshOnActivate="true" />
</cflayout>
Yep, it's as I suspected... you need to escape your single quotes in your variable. If you look at the mark-up generated for 1.cfm, you'll see the mark-up is invalid for the NEXT link.
Have a look at jsStringFormat()... it should do the trick...
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_in-k_46.html#1106993
--
Adam
Copy link to clipboard
Copied
Since no one wanted to try, may be paging is what cflayout should be considering handling in its later version.
Copy link to clipboard
Copied
I think you could possibly benefit from going over the docs, as it's explained in there. You need to understand that whilst these layout components look like distinct areas of the screen, it's all really just mark-up and styling within the main HTML doc, so any <a href=""> links are goign to redirect the entire window, not just the one area on the screen. The web browser doesn't know you want to treat these individual areas in a special way.
But Adobe have second-guessed people's requirements here.
Docs:
<cflayoutarea>
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7a23.html
From there there's a link to "Using Ajax User Interface Components and Features":
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7a01.html#WSc3ff6d0ea77859461172e0811cbec22c24-60bd
And within that there's a section "Control container contents":
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7a01.html#WSc3ff6d0ea77859461172e0811cbec22c24-60bd
And within that there's reference to ColdFusion.navigate:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS0ef8c004658c1089-6262c847120f1a3b244-7fd0.html
--
Adam
Copy link to clipboard
Copied
Hi Adam. Thanks for your advice and reference links. It seems that not many people have such experience yet, for I could not find similar post in the forum. And also because I am using CF8 some of the links may not apply. Appreciate you help very much though.
Jush
Copy link to clipboard
Copied
OK, well it didn't take much effort to find the CF8 equivalent pages:
<cflayoutarea>
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_j-l_02.html#3984637
From there there's a link to "Using Ajax User Interface Components and Features":
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=ajaxdata_01.html#1156467
And within that there's a section "Control container contents":
(same page, no direct link)
And within that there's reference to ColdFusion.navigate:
http://livedocs.adobe.com/coldfusion/8/JavaScriptFcns_24.html
People might not have posted too many questions about this specific thing here, because it's well documented and - once one has found & read the docs - fairly straight forward?
--
Adam
Copy link to clipboard
Copied
Thank you Adam. It helped me when going through the documents suggested. I could make it working OK except when I tried to pass a url variable like the following "page.cfm?filter='where status in ('A','B', 'S')'&type =1&cat='one'". I always got a javascript error, which either empty line or a ajax library which does not make sense. If I remove filter url param, only Type and Cat it works as I wanted. It is the chars are not welcomed in the url.
I tried preservesqlString and urlencodeformat, but did not succede. Please advice. Thanks.
Copy link to clipboard
Copied
I presume it's the way the URLs are passed... they're probably passed as part of a single-quote-delimited string. So you embedded single quotes are messing that up (they're being seen as string-delimiters, not data. So you'll need to escape your single quotes.
Can you concoct a small (but complete & self-contained) bit of code that demonstrates this issue?
--
Adam
Copy link to clipboard
Copied
Sure Adam, here you are: (in t1.cfm. if change to use Variable t. you will get error. but variable f is ok.
index.cfm
<div style="width:599px; border:1;">
<cflayout type="tab" Name="RequestStatus" >
<cflayoutarea title ="tab1" name ="t1" source="t1.cfm">
</cflayoutarea>
<cflayoutarea title ="tab2" name ="t2" source="t2.cfm">
</cflayoutarea>
<cflayoutarea title ="tab3"name ="ts" source="t3.cfm">
</cflayoutarea>
</cflayout>
</div>
-------------------------------------------------------------
t1.cfm (for testing t2, t3 can be the same)
<cfset f="Where Emp_id in (1,5,3,7,2,4,6,8)">
<cfset t="WHERE (lastName like ('A%') or lastName like 'C%' or lastName like 'X%' or lastName like 'P%' or lastName like 'R%' or lastName like 'B%') AND firstname <> ' '">
<cfquery name="qEmployee" datasource="cfdocexamples">
SELECT Emp_ID, FirstName, LastName, Email, Department
FROM Employees
#PreserveSingleQuotes(f)#
</cfquery>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="5">
<CFPARAM name="URL.currentrow" default="1">
<cfset fitler="Where left(sales,1) like 'A'">
<cfset qmaxrows = 3>
<cfset next = URL.currentrow + qmaxrows>
<cfset prev = URL.currentrow - qmaxrows>
<cfset qtotal = qEmployee.recordcount>
<cfset thispagemax = (qmaxrows + url.currentrow) - 1>
<cfoutput>
Showing #URL.currentrow# -
<cfif thispagemax GT qtotal>
#qtotal#
<cfelse>
#thispagemax#
</cfif> of #qtotal# records.<br />
<cfif url.currentrow gt 1>
<a href="javascript:ColdFusion.navigate('#cgi.SCRIPT_NAME#?1=1¤trow=#prev#','t1')" >Previous</a>
<cfelse>Previous</cfif>
|
<cfif thispagemax lt qtotal>
<a href="javascript:ColdFusion.navigate('#cgi.SCRIPT_NAME#?currentrow=#next#&f=#URLEncodedFormat(f)#','t1')">Next >></a>
<cfelse>Next</cfif>
</cfoutput>
</td>
</tr>
<tr valign="top" style="color:Snow; background-color:OrangeRed; font-weight:bold">
<td>
Employee ID
</td>
<td>
First Name
</td>
<td>
Last Name
</td>
<td>
Email
</td>
<td>
Department
</td>
</tr>
<cfoutput>
<cfloop query="qEmployee" startrow="#URL.currentrow#" endrow="#thispagemax#">
<tr valign="top" style="color:OrangeRed;">
<td>
#qEmployee.Emp_ID#
</td>
<td>
#qEmployee.FirstName#
</td>
<td>
#qEmployee.LastName#
</td>
<td>
#qEmployee.Email#
</td>
<td>
#qEmployee.Department#
</td>
</tr>
</cfloop>
</cfoutput>
</table>
Thanks.
Copy link to clipboard
Copied
Yep, it's as I suspected... you need to escape your single quotes in your variable. If you look at the mark-up generated for 1.cfm, you'll see the mark-up is invalid for the NEXT link.
Have a look at jsStringFormat()... it should do the trick...
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_in-k_46.html#1106993
--
Adam
Copy link to clipboard
Copied
Thank you so much Adam. Appreciate!