I think the code might look like this
var alertIDs = {themodal: 'alertmod', modalhead: 'alerthd', modalcontent: 'alertcnt'}; $.jgrid.viewModal("#" + alertIDs.themodal, {gbox: "#gbox_" + $.jgrid.jqID(this.p.id), jqm: true}); $("#jqg_alrt").focus();
where this.p.id
(or $.jgrid.jqID(this.p.id)
) can be replaced with the grid identifier. To be more confident that the alert work that I recommend you is recommended to use a longer code
var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'}; if ($("#"+alertIDs.themodal).html() === null) { $.jgrid.createModal(alertIDs,"<div>"+$.jgrid.nav.alerttext+ "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {gbox:"#gbox_"+$.jgrid.jqID(this.p.id),jqModal:true,drag:true,resize:true, caption:$.jgrid.nav.alertcap, top:100,left:100,width:200,height: 'auto',closeOnEscape:true, zIndex: null},"","",true); } $.jgrid.viewModal("#"+alertIDs.themodal, {gbox:"#gbox_"+$.jgrid.jqID(this.p.id),jqm:true}); $("#jqg_alrt").focus();
Demo demonstrates the code. It displays a message
every time you click the "Click me!"
.
UPDATED: The answer contains information on how to use the above dialog in a free jqGrid . It describes many options. The simplest version contains only one simple call to this.modalAlert();
. It displays the same warning dialog that displays the jqGrid's internal screen.
source share