Filter not clearing manually in CGridView Yii

Problem: after ajax update CGridView we can't clearing filter manually.
In start our CGridView is viewing like this:

$this->widget(
	'booster.widgets.TbGridView',
	array(
		'type' => 'bordered hover',
		'dataProvider' => $contacts->smartSearch(),
		'filter' => $contacts,
		'ajaxUpdate' => true,
		'id' => 'contacts-grid',
		'columns' => array(
			....
		)
	)
);

I'm usually using TbGridView, but we have not difference between it and CGridView.
So, we forget option ajaxUrl which solve the problem of formation GET request and will remove garbage from the query string to the server.

$this->widget(
	'booster.widgets.TbGridView',
	array(
		'type' => 'bordered hover',
		'dataProvider' => $contacts->smartSearch(),
		'ajaxUrl' => array('/contacts/index'), // <<<<<<<< THIS
		'filter' => $contacts,
		'ajaxUpdate' => true,
		'id' => 'contacts-grid',
		'columns' => array(
			....
		)
	)
);

Leave a Reply

Your email address will not be published. Required fields are marked *