[coldbox:11484] Re: Paging

Aaron thanks for your answer. I am still without understanding this plugging. I can display the results on internet explorer (the links with the number of pages)but not on firefox. Also i don't understand how to send the variable 'page' where do i get that from?

Never mind… it displays the links on firefox as well but the links dont work correctly

I am reading the documentation on the coldbox site AGAIN to try to understand the Paging plugin.

This is what I am doing:

Everything starts when the user submits a form with the search criteria (date, market, dealer etc).

The form action calls my handler "exampleHandler.eventGetValues’.

In my handler a i am calling:

rc.pageBoundaries = getMyPlugin(

“Paging”).getBoundaries();

Then I am adding the “rowfrom and the rowTo” to my “searchCriteria” structure

searchcriteria.rowFrom = rc.pageBoundaries.startRow;

searchcriteria.rowTo = rc.pageBoundaries.startRow + getMyPlugin(“Paging”).getPagingMaxRows(); ( is this ok? )

Now I call my service and get the query results:

exampleService.getQryResults(searchcriteria)"

I have another function that gives me the total of entries in this query:

rc.entriesTotal = qryTotal.total;

Now in my view:

#getMyPlugin(

“paging”).renderit(foundRows=rc.entriesTotal,link=event.buildLink(‘exampleHandler.eventGetValues&page???’))#

(How do I get the page variable??? I dont understand)

I am able to see the links but when I click on them I am getting two errors:

  1. The value ‘’ cannot be converted to a number. because the variable page doesn’t exists.

  2. My form values are gone so I can not get the search criteria values to send them to my exampleService…

hope this is clear enough… Please help!

@page@ needs to be passed in the link, it right there in the documentation.

I have made a better one, and will release it as soon as I clean it up some.

Ok as promised a better version, usage is the same as the one Luis wrote, only it now supports adjacent pages.

<!-----------------------------------------------------------------------

Great Andrew!!!. Thanks for your help … will take a look at your version, seems pretty good…

In my search for finding a way to paginate I found another good plugin. Here is the link:
http://www.dopefly.com/projects/pagination/

Maybe someone will be interested in it. It has great documentation and real examples. Althoug is not made for coldbox there is a small modification that needs to be added. A paramenter called event. This paramenter will add the name of the event to the “page links” that are generated. It also has several styles… Thanks again for all your help :slight_smile:

Alexandra

Wish I had found that earlier, that is exactly what I rewrote this to do.