2

I have setup in jqGrid a delete function call that uses the native features for checking if a row have been selected in the grid or not as in the following code sample:

$("#myGrid").jqGrid('navGrid', '#pager',
     { add: true, addtitle: 'Add record',
       edit: true, edittitle: 'Edit record',
       del: true, deltitle: 'Delete record',
       addfunc: addFulfilment, editfunc: editFulfilment
     },
     {}, // default settings for edit
     {}, // default settings for add
     {
         // define settings for Delete 
         mtype: "post",
         reloadAfterSubmit: false,
         onclickSubmit: function (rp_ge, postdata) {
             rp_ge.url = '/Customer/Delete/' + postdata;
         }
     }, 
     {}, // search options
     {}
);

This works fine showing a confirm message before the delete method get called.

Is there a way to customize the delete message that appear on the popup window?

Lorenzo
  • 29,081
  • 49
  • 125
  • 222

1 Answers1

6

You can set $.jgrid.del.msg or redefine other parameters from the localization file like grid.locale-en.js:

del : {
    caption: "Delete",
    msg: "Delete selected record(s)?",
    bSubmit: "Delete",
    bCancel: "Cancel"
},

You can overwrite some parameters only for one grid using additional prmDel option of the navGrid with the same name (msg for example). Inside of navGrid the default values $.jgrid.del will be combined with the current prmDel options.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks! Is there a way to customize the popup dialog? I mean dimension, the fact that is resizable and so on? – Lorenzo Oct 26 '10 at 08:56
  • @Lorenzo: If you need more customizations you can define additional CSS parameters of the classes used in the Delete dialog: `delmsg`, `formdata`. In the CSS you can make some changes only for ids like "delmodnav"+grid.id and so on. I recommend you examine the dialog with some developer tools in IE, FF or Chrome. Corresponding CSS definition based on the classes or ids should solve all your problems. – Oleg Oct 26 '10 at 09:17
  • @Oleg : Sorry this is an old but wanted to know how can we change the caption and text of delete dialog in jqgrid (4.15.2) – aman Jan 23 '18 at 16:23
  • @aman: Yes, one can specify all the settings too. There are some small difference because free jqGrid allows to specify *different `del` settings for different languages*. You can overwrite the settings for *some locale* or *for the grid*. For grid settings you can include `caption`, `msg` and so on in `formDeleting` option of jqGrid (see https://jsfiddle.net/OlegKi/rmo2370r/19/ from [the answer](https://stackoverflow.com/a/48102515/315935)). To make global settings for en-US locale: changes properties of `$.jgrid.locales["en-US"].del` instead of `$.jgrid.del`. – Oleg Jan 23 '18 at 16:37
  • Works fine. Thanks for the quick response. – aman Jan 23 '18 at 16:57