GridView filter doesn't send form in IE8

Developing a site with Yii framework.

When I type keywords to search in the GridView filter input box and then hit Enter - the form is not submitted to the server. But hitting Tab or clicking with a mouse outside the input field - does work.

The problem is in IE and Opera. Firefox is fine.

There’s this forum topic with a workaround for similar problem but jquery.yiigridview.js code has changed since the post of that workaround. It now uses on() function instead of live().

The code is pretty different now, I’m not sure I’ll be able to come up with new workaround myself. Can anybody adapt that patch for current jquery.yiigridview.js?

So, as far as I understand, this is the piece that handles submition of filter input.


$(document).on('change', inputSelector, function () {

    var data = $(inputSelector).serialize();

    if (settings.pageVar !== undefined) {

        data += '&' + settings.pageVar + '=1';

    }

    $('#' + id).yiiGridView('update', {data: data});

});

It works in Firefox and doesn’t work in IE or Opera.

Any ideas how to fix it?

Rewrote my question. Added new info. Up.

I haven’t tried (no time and no available MSIE8 now), but maybe like this?


$(document).on('change', inputSelector, function () {

    var data = $(inputSelector).serialize();

    if (settings.pageVar !== undefined) {

        data += '&' + settings.pageVar + '=1';

    }

    $('#' + id).yiiGridView('update', {data: data});

});


//.. temporary fix for the bug of supporting live change in IE

// (original: MD 08.06.2010)

// http://www.yiiframework.com/forum/index.php/topic/9732-critical-problem-in-ie-8-with-cgridview/page__view__findpost__p__48081

if($.browser.msie) {

    $(document).on('click keyup', inputSelector, function(){

        $(inputSelector).change(function(){

            var data = $(inputSelector).serialize();

            if (settings.pageVar !== undefined) {

                data += '&' + settings.pageVar + '=1';

            }

            $('#' + id).yiiGridView('update', {data: data});

        });

    });

}

I’m sorry I have replied without reading the whole post you were referring to.

I mentioned the post I used to suggest the modified code, but if it doesn’t work (see the older thread), maybe you’d like to test this post: http://www.yiiframework.com/forum/index.php/topic/9732-critical-problem-in-ie-8-with-cgridview/page__view__findpost__p__53016

By now I’m using this hack for jquery.yiigridview.js




if($.browser.msie || $.browser.opera) {

	    $(document).on('keypress', inputSelector, function(event){

	        if(event.keyCode == 13) {

	            var data = $(inputSelector).serialize();

	            if (settings.pageVar !== undefined) {

	                data += '&' + settings.pageVar + '=1';

	            }

	            $('#' + id).yiiGridView('update', {data: data});

	        }

	    });

	} 



But it’s kinda ugly.