Tips on aligning header and column divider lines when scrolled all the way to the right in free jqgrid

When jqgrid is scrolled all the way to the right, the column separator lines become misaligned.

To replicate this issue, widen the jqgrid beyond the browser window or decrease the browser window width until a horizontal scrollbar appears. Then scroll horizontally to the far right. The header and column separator vertical lines will be in different positions.

Any suggestions on how to resolve this problem?

Answer №1

If your code is lengthy, it's not the aim of stackoverflow for someone else to debug it for you. It would be helpful if you could create a small demonstration that showcases the issue.

Upon debugging, I noticed that the grid initially lacks a horizontal scrollbar. Free jqGrid has a mechanism to determine whether the grid needs a horizontal scrollbar after the data has been loaded. It adjusts the padding-right of hbox (a div nested within hdiv with the class ui-jqgrid-hbox) based on the width of the scroll bar:

bDiv.offsetWidth - bDiv.clientWidth
(refer to this line and this one in the code).

If you click on the Reload grid button after encountering the scrollbar issue, it should correct itself. Therefore, it seems likely that modifications made to the page post-data loading are triggering the appearance of horizontal scroll bars. Since jqGrid doesn't detect these changes, the problem persists.

To address this, manually invoke the fixScrollOffsetAndhBoxPadding method after implementing any unclear modifications that lead to horizontal scroll bars (e.g., adjusting the grid's width with

$grid.jqGrid('setGridWidth', $('#grid1container').width(), false);
).

You can simply include the following call:

$grid[0].fixScrollOffsetAndhBoxPadding();

somewhere after the grid's scrollbar is generated. This method is public and part of the grid's DOM (refer to this line). The provided code snippet should resolve the issue.

Executing

$("#grid")[0].fixScrollOffsetAndhBoxPadding();
in the browser console confirms that the problem is resolved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discovering if a div element has children using Selenium IDE

As I begin to automate testing for our website with Selenium IDE, I must admit that I am still learning the ins and outs of it. We utilize highcharts to exhibit data on our site. The challenge arises from the fact that there are 3 div elements handling th ...

Error in Rails app when incorporating Stripe API with Javascript involved

Incorporating Stripe into my rails app using the Koudoku gem has been challenging. When attempting to load the page for capturing user credit card information, I encounter an error in my JS console: Uncaught ReferenceError: $ is not defined (anonymous fun ...

What is the best way to extract the innerHTML of every button and exhibit it in a text box?

How can I create a simpler JavaScript code for clicking buttons to input letters into a text box? Instead of creating getElementByID for each button, is it possible to use some kind of loop? <div id="alpha" > <br/> <div align="cente ...

What is the correct way to properly insert a display none attribute

I'm experiencing some alignment issues with the images in my slideshow. I used this example as a reference to create my slide: https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_slideshow_dots When clicking on the next image, it seems to mo ...

Drag and drop surprise: When items are dragged onto the screen, a magical box will appear. But watch as the box disappears when the item is dragged

I am a newcomer to knockout JavaScript and am currently utilizing Knockout drag and drop functionality in my project. Initially, I have two divisions - one is visible while the other has a display property set to none. During the drag enter function, I wan ...

Tips for correctly escaping special characters when incorporating them into an element attribute

When retrieving values from the backend to create a group of checkboxes, I am encountering an issue where one of the values is not being set properly with my checkbox. The text in question is: "French (Cote d'Ivoire)" However, the output I am receiv ...

Show error messages from HTML 5 Validation using a software program

Is it possible to manually trigger the HTML 5 validation message using code? As far as I can tell, there isn't a straightforward way to do so directly. However, it seems we can prompt this message by simulating a click on the submit button. I attempt ...

The blur function in jQuery is not functioning as expected

I'm facing an issue where only the first of my 3 .blur's is working. Here is the jQuery code snippet: <script type='text/javascript'> $(document).ready(function() { $("#user_name").blur(function() { if ($( ...

Utilize Bootstrap columns to maximize vertical space efficiency

I recently came across a bootstrap layout like this: https://i.sstatic.net/VXBCF.png In this setup, there is a single .row that contains 8 .col-lg-3 divs. However, I noticed that there is excessive vertical whitespace present, which not only looks undesi ...

What is causing the classList function to throw an error: Uncaught TypeError: Cannot read properties of undefined (reading 'classList')?

There's an error that I can't figure out: Uncaught TypeError: Cannot read properties of undefined (reading 'classList') console.log(slid[numberArray].classList) is working fine, but slid[numberArray].classList.add('active') is ...

Placing an object to the right side

I'm currently developing an app using React Native and I need to position something on the right side of the screen. <View style={searchDrop}> <TextInput style={textInput} placeholder="Search Coin ...

Which IDE is best for JavaScript development on Ubuntu 11.04?

After years of developing and debugging Javascript on Windows using Visual Studio, I recently made the switch to Ubuntu. However, I'm finding it difficult to adjust to the default editors like vim and gedit. Can anyone recommend an IDE for me to use o ...

Is it better to use remove() or destroy() in TinyMCE 4?

I am currently using the TinyMCE editor from TinyMCE, and I am looking to remove or destroy the editors on my page, which contains multiple editors. I also want to get rid of any classes and IDs that were added by TinyMCE. However, I want to keep the edit ...

Ways to ensure that both the Search text field and search button are of equal height

I am facing an issue with the layout of my HTML code within my ASP.NET MVC web application. Below is the snippet of code causing the problem: <form class="customSearch" method="GET" action="@Url.Action("Search", "Home")"> <input class="searchIn ...

How can I change JSON to an array using Jquery?

Snippet var jsonData = '{"Error":"Only alphabet characters and spaces are allowed in the name"}'; try { // Parsing JSON string into a JavaScript array var dataArr = $.parseJSON(jsonData); // Iterating through the array for (let key i ...

Dynamic Creation of a jQuery Selector

Dear, I'm facing an issue while trying to load data dynamically into a table using JSON format. The data is coming from a PHP file. However, despite my attempts, the table remains empty and no data is being displayed. function fetchTableData() { ...

The radio button in the HTML form is disabled when the user selects

I have two radio buttons labeled Billable "Y" and Billable "N". These radio buttons are linked to a database with corresponding values of "Y" or "N". If the user selects "Y" using the radio button, then the NonBillableReason text box should be disabled. ...

The issue with the Material UI Drawer component is that it is casting a shadow even when

Having some trouble with the Material UI Drawer component. Whenever I try to display it on my webpage, it automatically focuses on the inner div, adding a shadow or border if the focus is anywhere else. Does anyone know why this shadow appears and how to r ...

"Bootstrap - creating a dynamic effect with a repeating pattern overlay and vibrant background color in

I'm having trouble adding a repeating background image to my jumbotron that already has a rebecca-purple background color. I've tried multiple approaches, but can't seem to get it right. Here's the code snippet I'm working with: . ...

Alert the administrator if the app experiences a crash in a node.js environment

Within my setup, I have both a web app and a helper app running simultaneously. The helper app is responsible for updating specific values in the database that are utilized by the web app. These updates occur at regular time intervals thanks to the usage ...