yiisoft/yii — Issue #387: CGridView auto send filter request with delay
Author: jayala
Created: 2012-02-22 16:35:28+00:00
State: open

Something I think will be really useful is send automatically the request without pressing the enter key. Many frameworks do that and this one should too ;)

I done this by replacing the filter onChange event with this:

$(document).on('keyup', inputSelector, function (e) {
var data = $(inputSelector).serialize();
if (settings.pageVar !== undefined) {
data += '&' + settings.pageVar + '=1';
}
var delay = (e.keyCode == 13 ? 0 : 400);
clearTimeout($grid.attr('to'));
to = setTimeout(function(){ $('#' + id).yiiGridView('update', {data: data}); }, delay);
$grid.attr('to', to);
});