该 checkboxlist 字段呈现一个复选框列表。复选框列表支持与 下拉字段类型 相同的方法来定义选项,并且还支持可在 单选字段类型 中找到的辅助描述。
permissions:
label: Permissions
type: checkboxlist
options:
open_account: Open account
close_account: Close account
modify_account: Modify account以下 字段属性 受支持且常用。
| Property | Description |
|---|---|
| label | a name when displaying the form field to the user. |
| options | available options for the list, as an array. |
| optionsMethod | take options from a method defined on the model or as a static method, eg Class::method. |
| default | a default value to use for new records. |
| quickselect | show the quick selection buttons. |
| cssClass | used for setting the options as inline. |
| inlineOptions | display the options side-by-side instead of stacked, when less than 10 options. |
| placeholder | a message to display when there are no records selected (preview context). |
| cumulative | when checkboxes are nested, checking a parent will check all the children. Default: false |
您可以使用 default 属性来设置一个默认值,其中该值是选项的键。
permissions:
label: Permissions
type: checkboxlist
default: open_account选项可以彼此内联显示而不是单独成行,通过将 inlineOptions 属性设置为 true 值。这仅适用于可用选项少于 10 个时。
permissions:
type: checkboxlist
inlineOptions: true当列表项超过 10 个时,一个包含“全选”和“全不选”按钮的快速选择菜单将会显示。要明确启用这些按钮,请使用 quickselect 选项。
permissions:
type: checkboxlist
quickselect: true当使用 详细选项 时,复选框可以以嵌套结构显示,将 cumulative 属性设置为 true 如果您想在选中父复选框时同时选中所有子复选框。
permissions:
type: checkboxlist
cumulative: true