1

How do we position a alert message dialog box on the middle of jgGrid?

I am using two jgGrids on the page and tried with alerttop, alertleft as suggested by Oleg in jqGrid warning please select row position

But the problem is, the same alert box options are reused for all the grids in the page. In jqGrid ids for alert box is static and not grid context based.

(Line no: 8531 in 4.4.0 source file)

var alertIDs = { themodal: 'alertmod', modalhead: 'alerthd', modalcontent: 'alertcnt' }

and the below code is executed for only one grid

*if ($("#" + alertIDs.themodal).html() === null) {
                    if (!o.alerttop && !o.alertleft) {*

Due to this i cant able to position alert boxes for each grid.

Community
  • 1
  • 1
Murali Murugesan
  • 22,423
  • 17
  • 73
  • 120

1 Answers1

1

I agree, that it's a problem in jqGrid. The same problems was in Add/Edit/Delete/View dialogs, but the problem is already fixed.

I suggest that you just change the line

var alertIDs = { themodal: 'alertmod', modalhead: 'alerthd', modalcontent: 'alertcnt' }

to

var alertIDs = {themodal: 'alertmod_' + this.p.id,
        modalhead: 'alerthd_' + this.p.id, modalcontent: 'alertcnt_' + this.p.id}

in the file jquery.jqGrid.src.js directly.

UPDATED: After writing of the answer I posted the bug report. Now I can inform everybody that the corresponding fix is already included in the main jqGrid code on the github. So the next release of jqGrid (with the version higher as the current 4.4.1) will include it.

Oleg
  • 220,925
  • 34
  • 403
  • 798