[英]Yii CGridView filter on button click
i have some table in YII that uses CGridView. 我在YII中有一些使用CGridView的表。 I want to be able to enter all filtering data and then click on some button and only then send request to server. 我希望能够输入所有过滤数据,然后单击某个按钮,然后才向服务器发送请求。 Right now request is sent every time filter value changes. 现在每次过滤值更改时都会发送请求。 Is there any native Yii CGridView option to specify that? 是否有任何本机Yii CGridView选项来指定?
Insert this after CGridView widget: 在CGridView小部件后插入:
Yii::app()->clientScript->registerScript('gridFilter',"
$(function(){
$(document).off('change.yiiGridView keydown.yiiGridView');
$('body').on('click','.updateGridButtonSelector', function() {
$('#grid_id').yiiGridView('update', {
data: $('#grid_id .filters input').serialize()
});
return false;
});
});
", CClientScript::POS_READY);
See here: http://www.yiiframework.com/doc/api/1.1/CGridView and here: http://www.yiiframework.com/forum/index.php/topic/7320-how-to-disable-ajax-in-cgridview-or-clistview/ 请看这里: http : //www.yiiframework.com/doc/api/1.1/CGridView和这里: http : //www.yiiframework.com/forum/index.php/topic/7320-how-to-disable-ajax -in-cgridview或- CListView中/
Try with ajaxUpdate=>'false'
in the widget declaration. 在小部件声明中尝试使用ajaxUpdate=>'false'
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.