重定向分页器 -> 排序到 Cakephp 中的第一页

发布于 2024-08-20 21:39:26 字数 328 浏览 3 评论 0原文

如何进行分页器排序并指定它转到第一页:

echo $paginator->sort('Make', 'Car.make');

如果您在第 6 页并且想要按汽车品牌对列表进行排序。它会对列表进行排序,但会将您置于已排序列表的第 6 页。当有人点击“make”按钮排序时,我希望分页器将他们带到排序的第 1 页。我知道有一个 options['url']['page'] 变量,并且排序函数可以是 'sort($title, $key = NULL, $options = array())'。但是,我不知道在上面的 $paginator->sort 语句中设置该标志的正确语法是什么。请帮忙,谢谢!

How do I do a paginator sort and also specify it to go to the first page:

echo $paginator->sort('Make', 'Car.make');

If you're on page 6 and want to sort the list by car make. It sorts the list but puts you on page 6 of the sorted list. When someone clicks on the sort by "make" button, I want the paginator to take them to page 1 of the sort. I know there is an options['url']['page'] variable and that the sort function can be 'sort($title, $key = NULL, $options = array())'. However, I have no idea what the proper syntax is for setting that flag in the $paginator->sort statement above. Please help, thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

祁梦 2024-08-27 21:39:27

深入研究 PaginatorHelper API 一点,这应该可以工作:

echo $paginator->sort('Make', 'Car.make', array('url' => array('page' => 1)));

不过还没有测试过。

Digging through the PaginatorHelper API a bit, this should work:

echo $paginator->sort('Make', 'Car.make', array('url' => array('page' => 1)));

Haven't tested it though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文