0

I've workarea with some jqgrid with a complex system of alert dialog. I've a problem about addForm z-index which I can't change dinamically as the others dialog. I've a variable

increaseZIndex = 2000;

which I increase dinamically at each dialog creation:

increaseZIndex++;

But only in the addForm zIndex properties, this value doesn't change. I suppose the add Form dialog of the grid is created once and then it's only hidden and not been created as new at each new insert. Here's the code:

jQuery("#mygrid").jqGrid('navGrid','#pmygrid', {edit:false,add:true,del:false,search:false,refresh:false}, //options
                        {zIndex:1500,recreateForm:true}, // edit options
                        {zIndex:(increaseZIndex++),height:280,recreateForm:true, reloadAfterSubmit:true,url:"/myUrl.do",

and so on... How can I force this value to change dinamically as the others? Thanks!

Fseee
  • 2,476
  • 9
  • 40
  • 63

1 Answers1

0

First of all you should include recreateForm: true for both Add and Edit options. In the case the Add and Edit dialogs will be new created instead of making hidden/shown.

In all my projects I change recreateForm: true as the default setting by setting of the properties of $.jgrid.edit (see the answer or another one for the corresponding code examples).

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • I've already tried to set recreateForm:true but z-index value still doesn't change, see my edit – Fseee Sep 28 '12 at 12:31
  • @Franky: The code which you posted is out of context. `recreateForm:true` is required always. The part `zIndex:(increaseZIndex++)` could work only if you **recreate** the whole grid (with resepect of `GridUnload` for example). You can try to use alternatively to define `pAdd` object as `var pAdd = {zIndex:1000,height:280,recreateForm:true, ...}` and use `jQuery("#mygrid").jqGrid('navGrid',...,pAdd, ...);`. Because Add parameters are **not anonymous** you can change it with `pAdd.zIndex = 1500;` – Oleg Sep 28 '12 at 12:57
  • my addOptions are full of options like beforeShowForm, afterShowForme, afterComplete, about 200 lines of code i have to put all in an array??? And will it work without reloading the grid? – Fseee Sep 28 '12 at 13:37
  • @Franky: `pAdd` should be defined as *object* (var pAdd = {...}) and not as *array* (`var pAdd = [...]`). Of case the object can contain methods (`beforeShowForm`, etc) allowed for `editGridRow` (see [the documentation](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#events)). I can't grantee that *your code* will work in the case because you don't post it, but in general the code could work in the case without recreating the whole grid. – Oleg Sep 28 '12 at 14:12
  • Succesful after a lot of work. Thanks Oleg as always n.1 in jqgrid! – Fseee Oct 03 '12 at 10:10