Set datagrid to the width of its parent DIV
Below is a code snippet to resize the grid to fix only its parent container width.
<div id="mydiv" style="width:600px">
<?php
$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg->enable_autowidth(true)->enable_autoheight(true);
// set width to parent DIV
$dg->before_script_end .= 'setTimeout(function(){$(window).bind("resize", function() {
phpGrid_orders.setGridWidth($("#mydiv").width());
}).trigger("resize");}, 0)';
$dg -> display();
?>
</div>