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>

More details are available on auto width online demo: https://phpgrid.com/example/grid-auto-width/

Feedback and Knowledge Base