Home > Web Front-end > CSS Tutorial > Why Does jqGrid Show a Horizontal Scrollbar in Chrome, and How Can I Fix It?

Why Does jqGrid Show a Horizontal Scrollbar in Chrome, and How Can I Fix It?

Linda Hamilton
Release: 2024-12-28 15:41:51
Original
916 people have browsed it

Why Does jqGrid Show a Horizontal Scrollbar in Chrome, and How Can I Fix It?

jqGrid in Chrome: Horizontal Scrollbar Issue

You may encounter a horizontal scrollbar in jqGrid despite proper sizing of columns and the grid container in Chrome. This issue arises because of a mismatch between the calculated width and the actual rendered width of the grid.

Solution

The fix involves modifying the jqGrid code to incorporate a more accurate calculation of the grid's width. This includes:

  1. In line isSafari = $.browser.webkit || $.browser.safari ? true : false;, change it to:

    isSafari = ($.browser.webkit || $.browser.safari) && parseFloat($.browser.version)<536.5 ? true : false; // Chrome < version 19
    Copy after login
  2. In the functions showHideCol and setGridWidth, replace all instances of $.browser.webkit||$.browser.safari with ($.browser.webkit || $.browser.safari) && parseFloat($.browser.version)<536.5.
  3. You can also use a new method cellWidth that was introduced in later versions of jqGrid to ensure accurate cell widths.

Updated Considerations

Newer versions of Chrome use different WebKit versions. For Chrome 20 or higher, use parseFloat($.browser.version)<536.11 instead of parseFloat($.browser.version)<536.5.

The above is the detailed content of Why Does jqGrid Show a Horizontal Scrollbar in Chrome, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template