Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I find your question interesting. I invested some time and created <a href="http://www.ok-soft-gmbh.com/jqGrid/FrozenColumnsAndScrollbarOnTop.htm" rel="nofollow noreferrer">the following demo</a> which demonstrates how your requirements could be implemented. It displays</p> <p><img src="https://i.stack.imgur.com/qvfiA.png" alt="enter image description here"></p> <p>where one can use both horizontal scrollbars on the top or on the bottom of the grid. I used <a href="https://stackoverflow.com/a/3935190/315935">the answer</a> as the basis of creating the top scroll bar. Additionally I included the part of code which fixed the size and position of all jqGrid dives in case if the user uses zoom in the web browser.</p> <p>The most important part of the code of my answer I included below:</p> <pre><code>var $grid = $("#list"); // create the grid with some frozen columns $grid.jqGrid({ .... }); var $gview = $grid.closest(".ui-jqgrid-view"), $topToolbar = $gview.find("&gt;.ui-userdata"), $bdiv = $grid.closest(".ui-jqgrid-bdiv"), resetTopToolbarHeight = function () { var scrollbarHeight = 18; // some test value $topToolbar.find("&gt;div").height(scrollbarHeight); $topToolbar.css("border-top", "0").css("height", "auto"); scrollbarHeight = $topToolbar.height() - scrollbarHeight; $topToolbar.find("&gt;div").height(scrollbarHeight); $topToolbar.height(scrollbarHeight); fixPositionsOfFrozenDivs.call($grid[0]); }; // insert empty div in the top toolbar and make its width // the same as the width of the grid $topToolbar.css({ overflowX: "scroll", overflowY: "hidden"}) .append($("&lt;div&gt;").width($grid.width())); // set the height of the div and the height of toolbar // based on the height of the horizontal scrollbar resetTopToolbarHeight(); // detect scrolling of topbar $topToolbar.scroll(function () { // synchronize the srollbar of the grid $bdiv.scrollLeft($(this).scrollLeft()); }); // detect scrolling of the grid $bdiv.scroll(function () { // synchronize the srollbar of the toppbar $topToolbar.scrollLeft($(this).scrollLeft()); }); // detect zoop of the page and adjust the $(window).on("resize", function () { resetTopToolbarHeight(); fixPositionsOfFrozenDivs.call($grid[0]); }); </code></pre> <p>Other parts of the code I get from my old answers about the usage of frozen columns.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload