2

I have successfully increased the zIndex for edit,add,del and search options but alertmod is still at z-index 950 making it always behind parent modal.

alertmod is the warning message when click edit or delete without selecting any row. Is there a way to change the zIndex for alertmod?

new code but still not working... did I place it in wrong order

$("#list-employees-grid").jqGrid('navGrid',"#list-employees-pager",{alertzIndex:3234},
  {edit:true,add:false,del:true,search:true,},
  {zIndex:1234}, //option for edit
  {zIndex:2234}, // for add
  {zIndex:3234}, // del
  {zIndex:4234, multipleSearch:true, multipleGroup:true}  // search

  );
genpet
  • 453
  • 1
  • 9
  • 20

2 Answers2

2

There are some cases where the "alertmod" can be created. For example if you mean alerts from the navGrid you can use alertzIndex option which is currently just not documented in the list of navGrid parameters. Nevertheless you can use for example the following options used by alert dialogs: alertcap, alerttop, alertleft,alertwidth,alertheight,closeOnEscape, alertzIndex. See the line of code for details.

For example you can set default value for alertzIndex by

$.extend($.jgrid.nav, {alertzIndex: 1005});

UPDATED: I posted the feature request which could solve the problem with the options of alert dialog in the common case.

UPDATED 2: The feature request is already implemented in the jqGrid code on github (see here). So in the next version (the next after 4.4.0) one will be able to use

$.extend($.jgrid.jqModal, {zIndex: 1005});

to set default z-Index for all alert messages shown by jqGrid.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • I edited my post to include the alertzIndex but still not working. Did I put it in the correct order? – genpet Jun 27 '12 at 16:56
  • @genpet: I think you have some error how you verify that the parameter work. Just try to start [the demo](http://www.ok-soft-gmbh.com/jqGrid/zIndexTest.htm) and click on "Edit" button. You will get "Warning" alert. You can verify with respect of Developer Tools that the dialog div do has `z-index: 3234;` style. So everything work correctly. – Oleg Jun 27 '12 at 17:06
  • your demo shows z-index: 3234 correctly, but for mine its still 950. Did I get the code correctly just like I posted above? – genpet Jun 27 '12 at 17:13
  • @genpet: One error in your code I do see. You have to change `{alertzIndex:3234}, {edit:true,add:false,del:true,search:true,}` to `{alertzIndex:3234,edit:true,add:false,del:true,search:true}` which can be reduced to `{alertzIndex:3234,add:false}` because `edit:true,del:true,search:true` are defaults (please see exactly the [options](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:navigator#definition) of `navGrid`). I updated my demo to use `add:false` option too. – Oleg Jun 27 '12 at 17:17
  • Thanks. Dont know why still not updating, so I edited the navGrid options in jqGridmin.js and its now working.. – genpet Jun 27 '12 at 17:23
  • @genpet: The new small changes in the main code of jqGrid will simplify the solution of such problems in the nex version of jqGrid (see **UPDATED 2** part of my answer). – Oleg Jul 01 '12 at 11:06
  • @Oleg, I have added `alertzIndex`. but still z-index of alert message box is not changing. here is my line of code:`{search: false,pager:false, alertcap: "Warning", alerttext: 'Please select a Product',alertzIndex:1300},`. Please provide your suggestions. – vissu Jul 04 '12 at 05:40
  • @vissupepala: Try [the demo](http://www.ok-soft-gmbh.com/jqGrid/zIndexTest.htm) and verify that compare the `z-index` is correct. Then you can compare your code with my demo to find the difference and so the reason of your problem. – Oleg Jul 04 '12 at 05:56
  • @Oleg, Sorry I forgot to inform, I am using this grid in a dialog. However the alert dialog is coming behind the grid dialog. So I want to give more z-index to alert dialog. I have checked your demo code. Still I am not able to change z-index. – vissu Jul 04 '12 at 06:32
  • @vissupepala: If you post a link to the demo which reproduce the problem I could look at it in the evening. I am currently in business trip at one customer. – Oleg Jul 04 '12 at 07:46
1

Yes, there is an alertzIndex option that can be used to specify a custom zIndex. For example:

jQuery("#grid_id").jqGrid({
 ...
 pager : '#gridpager',
 ...
}).jqGrid('navGrid', '#gridpager', {alertzIndex: customZIndex, ...});

This option is missing from the jqGrid Navigator documentation and should probably have an entry in the Parameters section. You can see all of the possible options in the source code if you look at grid.formedit.js and browse to the navGrid function definition at line 1702.

Does that help?

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284