autocomplete 检查器类型的作用类似于 string 编辑器,不同之处在于它包含自动补全功能。可用选项可以通过 options 参数静态指定,或动态加载。
public function defineProperties()
{
return [
'condition' => [
'title' => 'Condition',
'type' => 'autocomplete',
'options' => ['start' => 'Start', 'end' => 'End']
]
];
}生成的输出是一个数组值,对应于所选选项,例如:
"condition": "start"以下配置值是常用的。
| Property | Description |
|---|---|
| title | title for the property. |
| description | a brief description of the property, optional. |
| default | specifies a default string value, optional. |
| options | array of options for dropdown properties, optional if defining a get*PropertyName*Options method. |
| showExternalParam | unsupported, and should be set to false. |
此类型不支持由
showExternalParam属性指定的外部参数编辑器。
autocomplete 检查器类型支持与 dropdown 检查器类型 相同的方法来定义选项。
public function defineProperties()
{
return [
'sortColumn' => [
'title' => 'Sort by Column',
'type' => 'autocomplete',
// ...
],
];
}
public function getSortColumnOptions()
{
return [
'create' => 'Create',
'update' => 'Update',
'delete' => 'Delete',
];
}