If I understand you correctly you need do something like the following
onCellSelect: function (rowid, iCol, cellcontent, e) {
$("#myoverlay").remove();
if (this.p.colModel[iCol].name === 'Overlay') { // iCol === 1
$('<div class="overlay" id="myoverlay">This is an overlay.</div>').css({
top: e.pageY,
left: e.pageX
}).appendTo('body');
}
}
instead of the code in the loadComplete
. Important is that the code above append the div to <body>
instead of <td>
element. One can just use the event
of the click to place the div in the corresponding position.
See the demo here.
You can easy modify the code to use the content of the div depend on the rowid
, cellcontent
or any other criteria.
By the way. In the HTML code which you use you should use <!DOCTYPE html ...
before <html>
and use type="text/css"
attribute in the <style>
. jqGrid has no cache: true
option.