Grid Width % of page Issue

QuestionsGrid Width % of page Issue
Darryl Brady asked 9 years ago

How do you set width to 90%

//$grid["forceFit"] = true;
//$grid["shrinkToFit"] = true;
//$grid["autowidth"] = true;
//$grid["width"] = "2000";
$grid["width"] = "90%";

I have tried a lot of setting but none seem to give me a grid that fits my page.
I would like to set the size to 90% of the page…

Also on my site its in a frame that seems to push it off the page for full size…

http://www.bradyfamilytree.org/genealogy/1859-searchgrid2.php

Regards
Darryl

10 Answers
Abu Ghufran answered 9 years ago

I would recommend to set

$grid["autowidth"] = true;

And then place the grid output var in a <div>

<div style='width:80%'>
<?php echo $out; ?>
</div>

Darryl Brady answered 9 years ago

Thanks Abu,
That has fixed my issue

Abu Ghufran answered 9 years ago

I tested following code on chrome, and working as expected.

http://pastebin.com/kEEEhsbq

Craig answered 9 years ago

Hi there,

This does not work for me in Chrome. I've set the options and the grid always is 100% width of the screen, no matter what container I have it in and the width of the container.

Has this been a recent fix?

Cheers,

Craig.

Craig answered 9 years ago

Thanks Abu,

I'll give it a test – at a quick glance, my code appears to be identical, but there is obviously something not correct.

Cheers,

Craig.

Craig answered 9 years ago

Hi Abu,

I've just checked this and you are correct – your example works for the initial load. However, if I set the width of the wrapper/container to 90% of the browser width, the wrapper/container flows with the width of the brwser, but the grid does not. It stays the originally loaded width. Then, on refresh, the size is re-calculated.

Also, the grid doesn't appear to honor the margin CSS tag, but does honor the padding tag.

These are the 3 options I'm using/testing (hopefully correctly):

$grid["forceFit"] = true;
$grid["autowidth"] = true;
$grid["autoresize"] = true;

<div style="width: 90%; border: 1px solid red;">
<?php echo $out; ?>
</div>

Cheers,

Craig.

Craig answered 9 years ago

It's the $grid["autoresize"] = true which is causing the problem.

If this is true, the grid doesn't honor the container width, and if it's false, it honors the container width but doesn't resize (obviously).

Would really like "autoresize" and honor container width please!

Craig answered 9 years ago

For anyone else looking at this, the issue turned out to be a combination of issues.

Firstly, I had nested containers each with varying margins/padding.

Secondly, it appears that jqGrid does not correctly honor the margin/padding of containers more than 1 level higher (ie. parent's parent).

I ended up having to remove the padding/margin from the top level containers to make this work "properly".

Montemaggiore Sebastian answered 8 years ago

Hello there. I have the same problem that Craig had, but i still don´t find a solution. The grid doesn´t fit the page. I use bootstrap 3.
The problem is that the grid doesn´t respect the width of it´s containers.
Can anyone help me!.
Here is my code: http://pastebin.com/HjRXmqB9
Thanks.
Sebastián Montemaggiore.

Abu Ghufran answered 8 years ago

I've emailed you latest build. Kindly recheck

Your Answer

16 + 8 =

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?