- $col_name: Column name
- $ctrl_type: HTML control type. A list of valid controls are:
- autocomplete – New!
- $keyvalue_pair: This parameter is only required when the $ctrl_type is type “select” or “checkbox”. It essentially represents list of value key pairs in the dropdown. e.g. “1:San Francisco;2:Boston;3:NYC”. It is ignored if the control type is not “select”.*
Hint: add “:;” (colon semicolon) to the front of the the key value pairs to add a blank dropdown option. Make sure there is no trailing semi-colon.
- $multiple: This parameter is only used when control type is “select”. It indicates whether multiple items can be selected in the list of options. The values are passed and stored as a comma delimited string. e.g. “1,2,3”. For single value “select”, this is not required.
- $dataUrl: This option is valid only for elements of type “select” and should be the URL to get the AJAX data for the select element. The data is obtained via an AJAX call and should be a valid HTML select element with the desired options <select><option value=’1′>One</option>…</select>. You can use option group. The AJAX request is called only once when the element is created. In the inline edit or the cell edit module it is called every time when you edit a new row or cell. In the form edit module only once.
- Set control of a specific column used for grid editing. It displays HTML input tag of different type accordingly e.g. <input type=”text” />, <input type=”textarea” /><
- Text and textarea are set automatically based on the database access library ADOdb metatype as the default edit control. Users do not need to understand how ADOdb works since phpGrid took care all the plumbing work internally. Isn’t that nice?
$dg -> set_col_edittype("officeCode", "select", "1:San Francisco;2:Boston;3:NYC", false);
$dg -> set_col_edittype("isActive", "checkbox", "1:0");
// bind dropdown menu to a lookup table
$dg -> set_col_edittype("officeCode", "select", "Select officeCode,city from offices",false);