Set Edit HTML Control
After enabling edit, you can set the type of HTML control with set_col_edittype() for any editable column used. List of Available controls are:
- text
- textarea
- select
- checkbox
- password
Text and textarea are set automatically based on the database access library ADOdb metatype as the default edit control.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | $dg = new C_DataGrid("select * from employees", "employeeNumber", "Employees"); $dg -> set_col_title("employeeNumber", "Emp No."); $dg -> set_col_title("lastName", "Last Name"); $dg -> set_col_title("firstName", "First Name"); $dg -> set_col_title("isActive", "Active?"); $dg -> set_col_format("email", "email"); $dg -> enable_edit("FORM", "CRUD"); $dg -> set_row_color("","","#DDEEF5"); $dg -> set_col_hidden('employeeNumber',false); $dg -> set_col_edittype("isActive", "checkbox","1:0"); $dg -> set_col_edittype("officeCode", "select", "1:San Francisco;2:Boston;3:NYC;4:Paris;5:Tokyo;6:Sydney;7:London"); // alternatively, bind dropdown menu to a lookup table this way // $dg -> set_col_edittype("officeCode", "select", "Select officeCode,city from offices",false); $dg -> display(); |


