0 Replies Latest reply on Apr 20, 2014 7:51 PM by sasaElla

    Pagination with Specific ID (Next/Prev)

    sasaElla

      I have settle down with my problem of pagination before.

       

       

      But instead of using

       

       

      **<< Previous Page // Next Page >>**

       

       

      I want it to be

       

       

      **<< {Director ID} // {Director ID} >>**

       

       

      Can anyone help me?

       

       

      This is my full code.

      I just wanted to change Previous/Next with the current Film Director displayed.

       

       

          <cfquery datasource="#dsn#" name="list">

          SELECT          *

          FROM          directorList

          </cfquery>

       

       

          <cfquery name="qIDHM" datasource="#dsn#">

          SELECT          directorID

          FROM          directorList

          WHERE          directorID = '#list.directorID#'

       

          GROUP BY          directorID

          </cfquery>

       

       

      <cfset OnEachPage="#qIDHM.recordCount#">

       

       

                <cfparam name="StartRow" default="1">

                <cfset EndRow=StartRow + OnEachPage - 1>

                          <cfif EndRow GTE list.RecordCount>

                  <cfset EndRow=list.RecordCount>

                  <cfset Next=false>

                          <cfelse>

                  <cfset Next=true>

                            <cfif EndRow + OnEachPage GT list.RecordCount>

          <cfset NextNum=list.RecordCount - EndRow>

                            <cfelse>

          <cfset NextNum= OnEachPage>

                            </cfif>

                  <cfset NextStart=EndRow + 1>

                          </cfif>

                <cfif StartRow IS 1>

                            <cfset Previous=false>

                <cfelse>

                            <cfset Previous=true>

                            <cfset PreviousStart=StartRow - OnEachPage>

                </cfif>

       

       

                <cfset NumPages=Ceiling(list.RecordCount / OnEachPage)>

                <cfparam name="PageNum" default="1">

       

      <cfform>

                <cfinput type="hidden" name="directorID"           value="#list.directorID#">

       

       

          <cfoutput><br><i>Display #StartRow# from #list.RecordCount# Search.</i><p>

                                              </cfoutput>

       

       

          <table border="1" >

          <cfoutput query="list" startrow="#startrow#" maxrows="#OnEachPage#">

          <thead>

          <tr>

          <th colspan="4">#list.directorID# [#qIDHM.recordCount# data]<br>#list.dirFilmTitle#   </th>

          </tr>

          </thead>

       

       

          <thead>

          <tr>

          <th>Film Title</th><th>Duration</th>

          </thead>

       

       

          <tbody>

       

       

          <tr align="left">

                                                                                                                           <td>#list.dirFilmTitle#</td>

                                                                                                                           <td>#FilmDuration#</td>

                                                                                                                           </tr>

          </tbody>

          </tbody>

          </cfoutput>

       

          <table border="0">

          <tr>

          <td valign="top">

          <cfif Previous>

          <cfoutput>

          <a href="directorPage.cfm?StartRow=#PreviousStart#&PageNum=#DecrementValue(PageNum)#<cfif IsDefined("Keyword")>&Keyword=#URLEncodedFormat(Keyword)#</cfif>">&lt;&lt; Previous ***(I want to put ID of director here)***</a>

          </cfoutput>

          <cfelse> 

          </cfif>

          </td>

                                                                                                                           <cfloop from="1" to="#NumPages#" index="ThisPage">

                                                                                                                           <cfoutput>

                                                                                                                           <cfif ThisPage IS PageNum>

                                                                                                                           <td>#ThisPage#</td>

                                                                                                                           </cfif>

                                                                                                                           </cfoutput>

          </cfloop>

          <td valign="top">

                                                                                                                           <cfif Next>

                                                                                                                           <cfoutput>

       

          <a href="directorPage.cfm?StartRow=#NextStart#&PageNum=#IncrementValue(PageNum)#<cfif IsDefined("Keyword")>&Keyword=#URLEncodedFormat(Keyword)#</cfif>">Next &gt;&gt;</a>

                                                                                                                           </cfoutput>

                                                                                                                           <cfelse> 

                                                                                                                           </cfif>

          </td>

          </tr>

          <tr>

          <td valign="top" colspan="<cfoutput>#Evaluate(NumPages + 2)#</cfoutput>">

          </td>

          </tr>

          </table>

       

          </table><br>