Use set_dimension() method to specify grid initial height and width. The default height and width is 400 by 300 pixels. In this example, the width is set to 800 pixel, and height is set to 600 pixel.
Wait, It looks funny! The grid height is taller than the space used by the number of rows in a page. To fix this, we can set bigger pagination to accommodate a taller grid. See the next example on pagination.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | // Always include namespace and conf.php on TOP of the script. use phpCtrl\C_DataGrid; require_once("/file/path/to/conf.php"); $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg -> set_col_hidden("requiredDate"); // change default caption $dg -> set_caption("Orders List"); // set export type $dg -> enable_export('EXCEL'); // enable integrated search $dg -> enable_search(true); // set height and weight of grid $dg -> set_dimension(800, 600); $dg -> display(); |