2008年9月24日星期三

Re: [fw-mvc] Zend_Paginator Partial

One way to do it:

1. Submit form as GET
2. Controller looks at Request object to pull appropriate search parameters
2. Uses search parameters to create SQL query, which it passes to paginator
3. Passes paginator and search parameters (including current page number) to PaginationControl helper

-Matt

On Wed, Sep 24, 2008 at 2:39 PM, Daniel Skinner <skinner@destiny-denied.co.uk> wrote:
I am using Zend_Paginator in a very standard setup.

My index action of the controller produces a form. Also, if the form is filled in (i.e. is valid), it (the same index action) proceeds to generate a collection of objects filtered by information entered into the form. This collection of objects in then paginated and all is well for the first page of results.

When I click onto the next page, the form data is not sent and so there is no model for the paginator to work with.

My immediate idea was to add an additional parameter to the first/next/last/prev links which could be used to regenerate the same model as the paginator was using with page 1.

The problem is that the pagination control is a partial and I cant figure out how to pass global view variables to it.

Is there a way to do this or is my general approach (i.e. adding query strings to the paginator URI's) wrong?

--

Kind Regards,

*Daniel Skinner*

*Tel:* 01977 87 80 22
*Fax:* 08455 08 36 15
*Mobile:* 07791 360 230
skinner@destiny-denied.co.uk <mailto:skinner@destiny-denied.co.uk>
www.destiny-denied.co.uk <http://www.destiny-denied.co.uk/>


没有评论: