JqGrid multiscreen list always has first option selected in edit mode with IE7 / 8

Grid (v4.3.1) selects the correct values ​​from the dropdown when entering edit mode.

However, the problem seems to be with IE 7 and IE 8, which automatically select the first item along with other values ​​that should be selected as well.

Has anyone stumbled upon this using IE7 / 8?

While researching the source for jqgrid, I also saw the commented line that would actually fix this issue. He was commented in this changeet and fixed another issue as Oleg pointed out. We have not yet figured out what the problem is.


source to share

1 answer

I have looked at the problem described and can confirm that this is a bug in the jqGrid. So +1 is for you anyway.


//if(i===0) { this.selected = ""; }


was commented after the fix you referenced was made based on an issue with select selectable singles . See message . Therefore, I can suggest two ways to fix the problem:

1) replace the above comment with the following lines

// fix IE8/IE7 problem with selecting of the first item on multiple=true
if (i === 0 && elem.multiple) { this.selected = false; }


2) add instead after the $("option",elem).each(function(i){...})


// fix IE8/IE7 problem with selecting of the first item on multiple=true
var $first = $("option:first",elem);
if($.inArray($.trim($first.text()),ovm) < 0 && $.inArray($.trim($first.val()),ovm) < 0 ) {
    $first[0].selected = false;


I'm not sure which bug fixes are the most secure.

The demo version can be used to reproduce the error. You can use IE9, launch Developer Tools with F12, select IE8 as "Browser Mode" and select "IE Standards" as "Document Mode". Finally, you can select "SM000237" in the grid and make sure that "Post Free" is selected along with "Bank Fees" instead of only selecting "Bank Fees".

the first and second demo fixes the bug and use the above fixes.