Skip to main content
Jush1
Known Participant
February 19, 2010
Answered

paging inside cflayout tabs

  • February 19, 2010
  • 1 reply
  • 1949 views

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>
    This topic has been closed for replies.
    Correct answer Adam Cameron.

    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&currentrow=#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 &gt;&gt;</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.


    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

    1 reply

    Jush1
    Jush1Author
    Known Participant
    February 22, 2010

    Since no one wanted to try, may be paging is what cflayout should be considering handling in its later version.

    Inspiring
    February 24, 2010

    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

    Jush1
    Jush1Author
    Known Participant
    February 25, 2010

    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