我有一个正确过滤的搜索页面,但是当它分页时,您会丢失数据,因为我正在发布它。所以我将它切换为 GET,但我不知道如何添加我传递回分页器的 http_build_query( $params )。
我尝试在选项的分页器 url 中设置查询参数,但没有运气,API 没有提到添加查询参数。
如何设置搜索结果查询参数,以便不同的页面知道它们被过滤的内容?因此,对 name=steve 和 company=SomeCompany 的搜索将通过第 2、3、4 页进行维护,每页有 10 个结果,并且不会重置为显示所有未过滤的 100 个结果。
控制器中的简单示例分页
$this->paginate = [
'limit' => 5,
'order' => [ 'CollectionAgencyAgent.id' => 'desc' ]
];
return $this->paginate( $this->CollectionAgencyAgent, $conditions );
带分页查看
<ul class="pagination <?php echo $class ?>">
<?php
$this->Paginator->options( [
'url' => [
'controller' => ''
]
] );
?>
<?php echo $this->Paginator->prev( __( '« Previous' ), [
'escape' => false,
'tag' => 'li',
'class' => 'arrow',
'disabledTag' => 'a'
] ); ?>
<?php echo $this->Paginator->numbers( [
'separator' => '',
'tag' => 'li',
'currentTag' => 'a'
] ); ?>
<?php echo $this->Paginator->next( __( 'Next »' ), [
'escape' => false,
'tag' => 'li',
'class' => 'arrow',
'disabledTag' => 'a'
] ); ?>
</ul>