enable_autowidth()

  • Parameters:
    • $autowidth: true or false
  • Description:
    • Use this method to set datagrid width as the same as the current window width.
    • Automatically resizes based on window width (verison 6+)
  • Example:
1
$dg -> enable_autowidth(true);

Set auto width to expand its container (e.g. body), then followed by setting static width for horizontal scroll. Works the best when the grid has many columns but in a small container.

1
2
$dg->enable_autowidth(true);
$dg->set_dimension('2000', 'auto', false);

Optional

Sometimes the browser overcalculates the document width and displays the scrollbar. You can hide it using the following CSS.

1
2
3
body{
  overflow:hidden;
}