yiisoft/yii — Issue #386: CGridView filter focus lost after AJAX filtering
Author: jayala
Created: 2012-02-22 14:44:06+00:00
State: open

What steps will reproduce the problem?
1.Create a CGridView widget with filters
2.Write something in a filter
3.Press Enter

What is the expected output? What do you see instead?
The correct output must be the updated rows, pager and keys of the CGridView. But instead the whole grid gets replaced and the focus of the control gets lost.

What version of the product are you using? On what operating system?
1.1.10 on Windows/Linux

A solution for this would be replace the line 357 of the file zii\widgets\grid\CGridView.php with this:
$ajaxUpdate=array_unique(preg_split('/\s*,\s*/',$this->ajaxUpdate.','.$id.' table.items tbody'.','.$id.' .pager'.','.$id.' .keys',-1,PREG_SPLIT_NO_EMPTY));
and the line 213 of zii\widgets\assets\gridview\jquery.yiigridview.js with:
if($(updateId).length==0)
$grid.append($(updateId, $data));
else
$(updateId).replaceWith($(updateId, $data));