Forum
15:41
28/01/2009
Hi, I’m new to jqGrid and let me say that it’s really a great project.
I’ve search the forum and the documentation but find no answer to my problem.
Let’s say I have a grid, with 3 columns (itemId, typeId, typeName)
typeId is hidden:true but edithidden:false (showing in editForm)
typeName is hidden:false but readonly:true (not showing in editForm)
in editForm typeId is render as select like (typeId1:typeName1;typeId2:typeName2;etc…)
When I open the editForm, the typeId select control index is 0 but I would have it to show me the index corresponding to the typeId value.
Can I change the selectedIndex in the editForm?
It cause me to have to reselect all those options when I go to the editForm.
(NOTE I have tried with onInitializeForm has suggested in another post (datepicker on editForm) but I didn't succes to hock the event. Any suggestion are welcome).
06:45
Moderators
30/10/2007
Hello,
Clould yo please post your code again with onInitializeForm?
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.
07:08
28/01/2009
A kick Google search this morning shows me that I was wrong..:) I was thinking the onInitializationForm was a grid Event and not a NavGrid event…
I should be ok by now I should have search more before posting, sorry for the trouble.
The code (without moving to selectedIndex, just hooking on onInitializeForm) :
jQuery(â€#grid-equipementâ€).navGrid(â€#pager-equipementâ€,
{refresh: true, edit: true, add: true, del: true, search: false, position:â€leftâ€},
{onInitializeForm:function(formId){alert(’ok’);}});
Thanks for you time
Solution (because I hate when I find a post in a forum that talks about my problem but didn’t explain how to fix it. )
NOTE : I use the pluggin to manipulate the select
http://www.texotela.co.uk/code.....ry/select/
jQuery(â€#grid-equipementâ€).navGrid(â€#pager-equipementâ€,
{refresh: true, edit: true, add: true, del: true, search: false, position:â€leftâ€},
{
// Edit option.
beforeShowForm:function(formId){
//$(â€#dateFabricationâ€, formId).datepicker({dateFormat:â€yyyy-mm-ddâ€});
// Ajustement des selects.
var rowId, selectValue;
rowId = $(â€#grid-equipementâ€).getGridParam(â€selrowâ€);
// Type équipement.
selectValue = $(â€#grid-equipementâ€).getCell(rowId, 5);
$(â€#typeIdâ€).selectOptions(selectValue, true);
// Fournisseur.
selectValue = $(â€#grid-equipementâ€).getCell(rowId, 7);
$(â€#fournisseurIdâ€).selectOptions(selectValue, true);
},
},
{
// Add option.
});
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66