By default, the edit form is displayed a single column table. This is fine for table with small numbers of fields. When you got a large number of fields, the chances are that you want to modify the layout to display multiple columns. Use formoptions property “rowpos” and “colpos” for this purpose.
The following example demonstrates a 2-column edit form.
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 | $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"); // enable edit $dg -> enable_edit("FORM", "CRUD"); $dg -> set_col_property("orderNumber", array("formoptions"=>array("rowpos"=>1,"colpos"=>1))); $dg -> set_col_property("orderDate", array("formoptions"=>array("rowpos"=>1,"colpos"=>2))); $dg -> set_col_property("requiredDate", array("formoptions"=>array("rowpos"=>2,"colpos"=>1))); $dg -> set_col_property("shippedDate", array("formoptions"=>array("rowpos"=>2,"colpos"=>2))); $dg -> set_col_property("status", array("formoptions"=>array("rowpos"=>3,"colpos"=>1))); $dg -> set_col_property("customerNumber", array("formoptions"=>array("rowpos"=>3,"colpos"=>2))); $dg -> set_col_property("comments", array("formoptions"=>array("rowpos"=>4,"colpos"=>1))); $dg->set_form_dimension(580, 270); $dg->enable_debug(false); $dg -> display(); |
See Live Example! (double click a row to see 2-column edit form)


