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_Related Related Topics sp_TopicIcon
3.8 Beta - DefaultValue lost on Cancel
07/09/2010
00:48
Avatar
sacobra
Member
Members
Forum Posts: 4
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

Hello,

I'm using Form Edit and have set a default Value for one of the field.

{name:'occ', index:'occ', editable:true, editoptions:{size:10, dataInit : function(elm){

   $(elm)[0].value = defOcc;

}}, editrules:{required:true, number:true}},

The default value is available the first time I add an entry.  If I click Cancel or try to add another entry, the default value is lost.

Is this a bug that needs to be fixed?

Regards

11/09/2010
12:31
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

dataInit should not be interpreted as function which lunches evey time when we are in add mode.

This event raises only once if the element is created.

Please refer to documentation - there is a option for this purpose named defaultValue and is editoptions array:

http://www.trirand.com/jqgridw.....ditoptions

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/09/2010
03:47
Avatar
sacobra
Member
Members
Forum Posts: 4
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

I did try using the defaultValue option.  I can't get it to work with variables though.

For example, the below does not seem to work.

{name:'occ', index:'occ', editable:true, editoptions:{size:10, defaultValue: defOcc},

  editrules:{required:true, number:true}},

However, if I replace the variable with a actual value it works!!

{name:'occ', index:'occ', editable:true, editoptions:{size:10, defaultValue: 10},

  editrules:{required:true, number:true}},

The solution I'm currently using is with the code I showed in my first post.  I added

recreateForm: true

 to make the default value appear every time.

21/09/2010
01:13
Avatar
sacobra
Member
Members
Forum Posts: 4
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

Does anyone know how to pass 'DefaultValue' a variable instead of the actual value?

23/09/2010
21:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Not sure what you mean. The defaultValue when set is a variable which has certain value. If you set defaultValue with varaible which changes dynamically maybe you will need to use beforeInitData event to change the defaultValue dynamically using setGridParam method.

Kind 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:
54 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