Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Possible 'select' bug in 3.4
12/01/2009
10:47
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Hi,

I am just testing 3.4 and I have run into a possible problem with inline editing where a select is present. The inline form that appears displays a multiple select dropdown where it should just display a single select dropdown.

I couldn't see anything in the docs about any new parameters but I noticed a size argument in grid.common.js. Adding a size argument with a value of 1 gives a single select however it still displays as a multi select in a single select space. I think this line is the problem:

jQuery(elem).attr({id:options.id,name:options.name,size:Math.min(options.size,so.length), multiple:msl });

The multiple:msl is set to either true or false and translates to the following html:

<select id="3548_Status" class="editable" name="Status" size="NaN" multiple="false">

Even when multiple is set to false, Firefox 3 on the Mac displays the select box as a multiple select. If msl = false then the multiple attribute of the select tag should be excluded. Also the default size should be 1 rather than NaN if size is not supplied as an argument.

Is this a genuine bug or am I missing something?

Cheers,

Dave

12/01/2009
12:21
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Dave,

Thank you for this. You are right.

The right syntax for multiple is (have checked in w3schools  🙂 )

<select name="nm" multiple="multiple">...

So it is quite possible that  some browsers intrepret only the first multiple ignoring the value. Will correct this.

Also for the size you are rigth too. Fixed.

Thank's

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

12/01/2009
12:35
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Thanks Tony, I thought I was going mad! I upgraded the code to 3.4 and the selects all went a bit crazy!

What do I need to change to fix the bug? Or have you posted a patch for grid.common.js?

Cheers,

Dave

12/01/2009
16:43
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Hi Tony,

I have applied a patch to my code which appears to work - not sure if it is the best way to do it but here is the snip from grid.common.js:

case "select" :
            var so = options.value.split(";"),sv, ov;
            elem = document.createElement("select");
            var msl =  options.multiple === true ? true : false;
            //added by Dave (phipps73@googlemail.com) - 12-01-2009
            var sze = options.size === NaN ? 1 : options.size;
            //end of Dave mod
            //jQuery(elem).attr({id:options.id,name:options.name,size:Math.min(options.size,so.length), multiple:msl });  removed by Dave (phipps73@googlemail.com) 12-01-2009
            //added by Dave (phipps73@googlemail.com) - 12-01-2009
            jQuery(elem).attr({id:options.id,name:options.name,size:sze });
            if(msl) jQuery(elem).attr({multiple:'multiple'});
            //end of Dave mod
            for(var i=0; i<so.length;i++){
                sv = so[i].split(":");
                ov = document.createElement("option");
                ov.value = sv[0]; ov.innerHTML = sv[1];
                if (!msl &&  sv[1]==vl) ov.selected ="selected";
                if (msl && jQuery.inArray(sv[1],vl.split(","))>-1) ov.selected ="selected";
                elem.appendChild(ov);
            }
            break;

Hope this helps! Feel free to point out any glaring mistakes - my js skills are a little weak 😉

Cheers,

Dave

14/01/2009
07:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks - the fix is similar.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
45 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information