Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colModel width property does not reflect actual width after resize #1

Closed
ddotsenko opened this issue May 11, 2009 · 2 comments
Closed

Comments

@ddotsenko
Copy link

The angle:
I am tweaking filterGrid object to size itself properly in "horizontal" mode, with gridToolbar=true. By properly I mean:

  • do NOT skip search=false; columns. Instead, render a td with nothing inside, with width equal to the that of corresponding column.
  • Include all visible columns in the rendering, including "cb" so that when the filterGrid is put on top of the columns, it lines up the input fields more or less exactly over the searchable columns.

The Problem:

  1. When filterGrid builds the array of settings it will use for the filterGrid object, it looks at colModel. colModel for some reason does not have the actual size of the columns when the columns were resized by hand. As a result of that, the search input fields are built with width different from actual column widths. As a result of that, the input fileds do not line up on top of columns.
  2. On occasion, I would like to store the view as configured by web site user. This should include the new width of resized columns. jqGridExport seems like a logical choice for getting the settings, but, because colModel is not updated when columns are resized, I am forced to scan grid.p.headers[i].width separately through evens system and put that in post data. Pain.

The solution:
Alter the 2 lines of code on Line 133. grid_base.js (v3.4.x) to look something like this:

var newColWidth = this.headers[idx].newWidth || this.headers[idx].width;
this.headers[idx].width = newColWidth;
this.cols[idx].style.width = newColWidth;
p.colModel[idx].width = newColWidth;

@tonytomov
Copy link
Owner

Hello,

  1. You are right the filterGrid method does not resize the columns when the grid is resized. The purpose oh this method is other and I show only one exmaple how this can be used. Developing this example I do not suppose that this will be so popular.
    Instead in 3.5 version I have created another method filterToolbar which do job.
  2. This is true and fixed in 3.5 version.
    Will try to fix in 3.4.4
    Thanks
    Regards

@tonytomov
Copy link
Owner

Also since we continue with 3.5 where this problem is resolved I will close the issue.
Tony

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants