Have looked on the jqgrid wiki but cant find what i need.
i have recreateform set to true and setting the width, works fine for edit, but when i try to add a new rec
You misunderstand the meaning of recreateForm
. I try to explain why it is needed.
The method navGrid has up to 7 parameters. You use only prmEdit
but not set the prmAdd
parameter. That is your main problem. The default implementation of "Add" and "Edit" dialog is so that one created dialog will be not closed, and only hide instead. Moreover, one dialog will be shared (!!!) as "Add" and "Edit" dialog. If recreateForm
is used that the previously created (and now hidden) dialog will be destroyed and the the new one will be created.
In your case you defined only "Edit" dialog parameters as {closeOnEscape:true, recreateForm: true, width:600}
. So if the user opens the "Add" dialog after the "Edit" dialog the previously hidden "Edit" dialog will be used as "Add" dialog. The title of the dialog will be changed of course.
So you can for example use
jQuery("#rowed2").jqGrid('navGrid',"#prowed2",
{edit:true,add:true,del:true,search:true,refresh:true},// navGrid options
{closeOnEscape:true, recreateForm: true, width:600}, // Edit options
{closeOnEscape:true, recreateForm: true, width:500} // Add options
);
or redefine the grid defaults which are common for both Edit and Add dialog. For example
jQuery.extend(jQuery.jgrid.edit, {
closeAfterAdd: true,
closeAfterEdit: true,
jqModal: false,
recreateForm: true,
savekey: [true,13]
});