通过搜索分页时的Cakephp URL [英] Cakephp URL while Paginating with search

查看:80
本文介绍了通过搜索分页时的Cakephp URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有搜索和分页功能的简单cakephp应用程序.我正在使用GET作为表单的类型.

I've a simple cakephp app with search and pagination. I'm using GET as type for forms.

当我单击带有所需过滤器的搜索时,将显示分页结果.当我在页面之间移动时,我得到了预期的结果(使用所需的页码索引和过滤的参数修改了URL).

When I click search with desired filters, paginated results are shown. I get desired results when I move across pages (with URL being modified with desired index of page number and filtered parameters).

说我在第4页的分页搜索结果中.现在,当我修改某个搜索过滤器并再次按显示的页面:4并单击搜索按钮时,如果结果记录较少(比如说可以容纳在一页上),则会出现错误-无法在服务器上找到xxxxxx. (....../page:4/....不存在)..

Say I'm on page:4 of paginated search results. Now when I modify some search filter and hit search button again with page:4 shown, if results have less records (say that can be accommodated on one page), I get error - unable to find xxxxxx on server. (....../page:4/.... doesn't exist)..

请帮助!

推荐答案

通常在您按下搜索键时,您想重置所有或相同的分页器参数

when you press search usually you want to reset all or same of the paginator parameters

我想您认为您确实做到了

I guess that in your view you just did

echo $this->Form->create('Model');

通过这种方式,蛋糕假设表单的操作就是您所在页面的网址

in this way cake assume that the action of the form is the url of the page you are in

但是您可以通过这种方式设置表单的网址

but you can set the url of the form this way

echo $this->Form->create('Model', array('url' => array('page' => 1));

这篇关于通过搜索分页时的Cakephp URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆