如何为gridview的分页部分禁用pjax?除了分页之外,其他任何东西都可以与pjax一起使用。这可能吗?
原因是因为我想在更改页面时发送分配的POST数据。会议不是一种选择。
我的网格视图:
echo GridView::widget
([
'id' => 'list_of_products',
'dataProvider' => $products,
'filterModel' => $productProvider,
'filterSelector' => 'select[name="per-page"]',
'summary' => '<div class="summary">Showing <b>' . $products->getTotalCount() . '</b> products</div>',
'columns' =>
[
....
],
'pjax' => true,
'responsive' => true,
'responsiveWrap' => false,
'pjaxSettings' => ['options' => [
'id' => 'kv-pjax-container',
'enablePushState' => false,
'options' => ['class' => 'row col-lg-6']
]],
'panel' => [
'heading' => '<h3 class="panel-title"> Search result</h3>',
'headingOptions' => ['class' => 'panel-heading product-container'],
'beforeOptions' => ['class' => 'kv-panel-before'],
],
'export' => [
'label' => 'Page',
'fontAwesome' => true,
],
'toolbar' => [
['content' =>
''
],
],
'toolbar' => [
'<div class="form-group pull-right">
<button onclick="addToList()" type="button" id="clear-filters" class="btn btn-primary">
<i class="fa fa-mail-forward"></i> Add to feed
</button>
</div>'
]
]);
}
?>
答案 0 :(得分:0)
您可以通过向此链接添加data-pjax =“0”属性来禁用容器内特定链接的pjax。
在您的网格中,只需设置选项'寻呼机':
echo GridView::widget
([
'id' => 'list_of_products',
...
'pager' => [
'linkOptions'=> ['data-pjax' => '0']
],
]);
文档: LinkPager