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
Default values for Select boxes
06/01/2009
15:27
Avatar
pkinsman
Member
Members
Forum Posts: 7
Member Since:
31/12/2008
sp_UserOfflineSmall Offline

I checked the documentation and forums and I don't think there is a way to set a default value for a dropdown. 

For example, when adding a new record, my users would like the dropdown values to default to the values used for the last record entered.  I think now the only way to accomplish this is to dynamically reorder the editoptions when the page is loaded, putting the "default" selected item at the top of the list.  

Please correct me if I am wrong!  Smile

08/01/2009
08:54
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You are right - there is no default value. In jqGrid this is the first one, but you can use with succes beforeShowForm when in add mode to set the default value of the select Wink

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.

15/01/2009
14:59
Avatar
pkinsman
Member
Members
Forum Posts: 7
Member Since:
31/12/2008
sp_UserOfflineSmall Offline

ROCK ON.  I was able to get it to work by doing something like this.  I will later swap out the hard coded value to a dynamic value that is pulled from the most recent grid record.  Thanks for the tip!!  Smile

.navGrid('#pager2',{

    edit:true,del:true,add:true,search:true

},                    {height: 250, width: 400, reloadAfterSubmit: true, modal: true, checkInput: true},    // edit options

                   {height: 250, width: 400, beforeShowForm:function(){

                     jQuery("#practice").val("BREO");

                   }},    // add options

                   {},    // del options

                   {}     // search options

)

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
64 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