fixing column headers while scrolling - jqgrid

后端 未结 4 998
粉色の甜心
粉色の甜心 2021-01-24 12:34

If my grid data scrolls over the current window, is it possible to freeze the column headers while scrolling the data so that column headers are always visible(like in excel). I

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 13:16

    This work for me (without grid css edit)

    document.getElementById("gview_" + gridID).style.height = "100%";
    document.getElementById(gridID).parentNode.parentNode.style.height = "100%";
    document.getElementById(gridID).parentNode.style.height = "100%";
    document.getElementById(gridID).parentNode.style.overflow = "auto";
    

    You have to use this code after grid initialization and you have to call your grid using this id to set the style:

    document.getElementById("gbox_" + gridID).style.width = "100%";
    document.getElementById("gbox_" + gridID).style.height = "100%";
    

    or

    document.getElementById("gbox_" + gridID).style.top = "0px";
    document.getElementById("gbox_" + gridID).style.left = "0px";
    document.getElementById("gbox_" + gridID).style.bottom = "40px";
    document.getElementById("gbox_" + gridID).style.right = "0px";
    document.getElementById("gbox_" + gridID).style.position = "absolute";
    

    and columns header are always visible!

    hope this help!

提交回复
热议问题