jqgrid - resize and overlay

前端 未结 1 593
傲寒
傲寒 2021-01-28 14:01

HTML


    
        

        
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-28 14:18

    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
            $('
    This is an overlay.
    ').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 instead of 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 before and use type="text/css" attribute in the