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
formedit select multiple size problem
13/04/2009
14:54
Avatar
akremedy
California, USA
Member
Members
Forum Posts: 37
Member Since:
16/12/2008
sp_UserOfflineSmall Offline

Hi Tony, I've run into a situation with formedit and (multiple) select fields where the "size:#" editoption is not honored.  The multi-select field is always constructed with size="1".  I am dynamically fetching my select options via beforeShowForm in the pager.

I can hack grid.common.js (line 236 in the 3.5A2 release) replacing:

size:Math.min(options.size,so.length)

- with -

size:options.size

but this defeats the feature of dynamically sized multi-selects when the options list is shorter than the defined size parameter.

What I notice is that so.length is always returned as 1.  My guess is that this is "as expected" under the circumstance since createEl doesn't know how many options exist until well after the actual form is rendered.  Does that sound about right?

I did this instead, which still seems clumsy, but if the answer to the question above is "yes", then I can't really think of a more elegant way to handle this outside of maybe an afterShowForm $('#field').attr('size',#) which still defeats the dynamic resize that I think was intended.

                    var so = options.value.split(";"),sv, ov;
//begin: multi-select hack for setting field length with dynamic options
//       in colModel editoptions, include 'fixedsize:#' param.
                    if(options.fixedsize) {
                        size = options.fixedsize;
                    } else {
                        size = Math.min(options.size,so.length);
                    }
//                    jQuery(elem).attr({id:options.id,name:options.name,size:Math.min(options.size,so.length) });
                    jQuery(elem).attr({id:options.id,name:options.name,size:size });
//end: multi-select hack for setting field length with dynamic options
                    for(var i=0; i<so.length;i++){

Thanks for any feedback, especially if I'm totally off-base and have just missed something simple,

Adam

14/04/2009
03:46
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The size options work for me. Maybe you set is as string. Try as number.

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.

14/04/2009
13:37
Avatar
akremedy
California, USA
Member
Members
Forum Posts: 37
Member Since:
16/12/2008
sp_UserOfflineSmall Offline

Thanks Tony, that's strange, I re-tested, but the behavior is the same...select multiple ignores the editoption size:5 (verified too with size:"5").  I'm thinking this has to do with the fact that I'm dynamically fetching my options list in the pager with beforeShowForm:

            }).navGrid("#"+pager_id,
                {edit:false,search:false},
                {},
                {height:160,
                 mtype:'POST',
                 addCaption:'Add Link to People',
                    beforeShowForm:function(formid){
                        $.ajax({
                            url:".assets/admin_people_tbl.php?oper=selpplsel",
                            datatype:"script",
                            mtype:"POST",
                            success:function(response) {
                                $('#username',formid).children().remove().end().html(response);
                            }
                        })
                    },

so, in createEl, so.length always gets returned as 1, and Math.min(options.size,so.length) sets the size to 1.

Maybe I'll hardcode an options list to see if the behavior changes - I'm better so.length would return the expected value and the size parameter would be honored (or so.length...whichever was smaller).

Thanks,

Adam

16/04/2009
02:28
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If you dynamically load this the option does not have sense, since the element is already created and you fill data in already created element from jqGrid. You should this manually whitin the request.

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:
98 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