Forum
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:21
Moderators
30/10/2007
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.
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
07:27
Moderators
30/10/2007
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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66