Rick, if you have 10,000 records, I would say to not dump them all into the client.

My suggestion would be to set everything up as if you were doing the pagination on the server using CF, and then change your pagination links so that they are intercepted, and used to do an ajax call to your CF template which retrieves the records.

Your CF template could output the records as an html table and then send that html back to the client -- this html would be the argument in your ajax callback function, which would take the returned html and place it in the right place on the page.

This is all independent of any plugins, just using straight jQuery and CF.

Just as a rough outline... suppose your pagination link looks like <a href="myCfTemplate.cfm" class="paginate">5</a> (this would be to go to page 5 of the pagination).

Your ajax call would look like something like:
$("a.paginate").click(function() {
   $.get(
       this.href,
       $(this).text(),
       outputhtml
   );
   return false;
});

Where "outputhtml" is the function that takes the returned html and outputs it to the page. This would send the data "5" to your CF template as an url variable, which you could use to determine which records to get from the database.

-- Josh

----- Original Message ----- From: "Rick" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Thursday, April 10, 2008 1:17 PM
Subject: [jQuery] Re: How do I use ColdFusion and jQuery variables for pagination?



Thanks for the reply, Josh...

I think the part that I'm not understanding is the "dump the whole
query
to the client and then the plugin takes care of the pagination."

It also sounds like a memory and/or processor intensive way to get 20
records
per page.  If I have 10,000 records, I guess I would be getting and
dumping
all 10,000 records at once?

I've considered taking the straight CF route with this, or perhaps
using SQL
to retrieve just the records I need.

Would using CF or SQL be preferable for datasets composed of thousands
of records?

Rick

On Apr 10, 3:31 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote:
Rick - I don't know how the pagination plugin that you're using works, but
there may be some sort of "before" event that you can use to ajax some
variables to your CF page. Your CF template would take these variables and
use them to set the startrow and maxrow values and then send back the
result.

That said, not sure why you'd need to do that if you're doing pagination on
the client side? The idea is that you dump the whole query to the client
and then the plugin takes care of the pagination.

-- Josh



----- Original Message -----
From: "Rick Faircloth" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Thursday, April 10, 2008 12:19 PM
Subject: [jQuery] How do I use ColdFusion and jQuery variables for

pagination?

> Hi, all...

> I'm a bit confused about how to get variables from jQuery that
> I can use in my ColdFusion code.

> In typical CF pagination, I use startrow and maxrows variables
> to limit the query output. How would I get these variables
> from the jQuery?

> I just can't piece together what's happening.

> Below is the jQuery I'm currently using. The total number
> of records is set in the jQuery using the recordCount CF variable.

> Thanks for any help!

> Rick

> <script type="text/javascript">

> function pageselectCallback(page_id, jq){
> $('#Searchresult').text("Showing search results
> "+((page_id*20)+1)+"-"+((page_id*20)+20));
> }

> $(document).ready(function(){
> // Create pagination element

> 
$("#Pagination").pagination(<cfoutput>#get_properties.recordCount#</cfoutpu­t>,
> {
> items_per_page:20,
> num_edge_entries: 2,
> num_display_entries: 20,
> callback: pageselectCallback
> });
> });

> </script>- Hide quoted text -

- Show quoted text -

Reply via email to