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