Forum
00:48
25/08/2010
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
12:31
Moderators
30/10/2007
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.
03:47
25/08/2010
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
to make the default value appear every time.
21:33
Moderators
30/10/2007
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.
Most Users Ever Online: 715
Currently Online:
24 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