列表组件操作

列表组件操作支持对 dataGrid 数据网格 或 treeDataGrid 树形数据网格 中展示的实体集合进行操作。这些组件实现了 ListDataComponent 接口。

当 dataGrid 或 treeDataGrid 添加了列表操作后,可以从组件的右键菜单调用。通常,组件也可以通过关联的按钮进行调用。

示例:

<hbox classNames="buttons-panel">
    <button action="departmentsTable.create"/>
    <button action="departmentsTable.edit"/>
    <button action="departmentsTable.remove"/>
</hbox>
<dataGrid id="departmentsTable" dataContainer="departmentsDc">
    <actions>
        <action id="create" type="list_create"
                actionVariant="SUCCESS" icon="PLUS_CIRCLE"/>
        <action id="edit" type="list_edit"/>
        <action id="remove" type="list_remove"/>
    </actions>
list actions 1

标准列表操作有下列类型:

list_add

操作类:AddAction

通过在列表视图查找实体实例的方式为数据容器添加已有的实体实例。可以用来填充多对多集合。

list_create

操作类:CreateAction

在实体详情视图创建一个新的实体实例。

list_edit

操作类:EditAction

在实体详情视图编辑选择的实例。

list_exclude

操作类:ExcludeAction

从数据容器中移除实体实例。与 list_remove 不同,list_exclude 操作并不会从数据存储删除选择的实体实例。通常用在多对多集合的选择中。

list_read

操作类:ReadAction

在实体的 只读视图 中显示选中的实体实例。只读视图通过 约定 选择。

如果实体没有只读视图,该操作会以与 list_edit 操作相同的方式打开实体详情视图,但会将所有字段设为不可编辑并禁用保存操作。如果希望允许用户将详情视图切换为可编辑模式,请在视图添加 detail_enableEditing 操作。

list_refresh

操作类:RefreshAction

重新加载列表组件(例如 dataGrid)使用的数据容器内容。

list_remove

操作类:RemoveAction

从 UI 数据容器以及数据存储中删除实体实例。