Skip to content

Set the grid width to the parent DIV

And add the following before $dg->display()

$grid->before_script_end .= 'setTimeout(function(){$(window).bind("resize", function() {
    gridParentWidth = $("#gbox_orders").parent().width();
    phpGrid_orders.setGridWidth(gridParentWidth);
}).trigger("resize");}, 0)';

Assuming your table name is "orders".

To completely hide the horizontal scrollbar


Add the following CSS to completely hide the horizontal scrollbar of the parent container. In this case, its id is "mydiv".

<style>
#mydiv {
    overflow-x: hidden;
}
</style>

Update: May 2022

Since version 7.5.2, this will be the default behavior when setting auto width. More details are available on auto width online demo: https://phpgrid.com/example/grid-auto-width/

Feedback and Knowledge Base