Best Fit Column Width

QuestionsBest Fit Column Width
Richard Lloyd asked 11 years ago

Hi Abu

What is the best way to automatically set the individual widths of each column to "best fit" its contents.

My fields vary in width over time so I was looking for an option that would take the maximum length of a field's content and set it as the width.

Thanks

3 Answers
Abu Ghufran answered 11 years ago

Hello,

There seems to be no best way to auto-resize the columns.
You will need some approximation and set width.

http://stackoverflow.com/questions/2299441/jqgrid-column-auto-width

pierre mata answered 9 years ago

Hello, my definitions of columns's width isn't working, even some titles doesn't, too, why?, by the way, i have many columns which isn't fit in the view grid, the horizontal scroll isn't show by default, , only show when adjust manually. thanks

Abu Ghufran answered 9 years ago

You an also set fixed pixel width to each column:

// to set exact pixel width
$col["fixed"] = true;
$col["width"] = "20";

To show horizontal scroll, refer faq: How can I set the width in this grid (even with horizontal scrollbar), i do not want to set screen size width but custom width size.

Your Answer

20 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?