跳转到内容

SyncTree 同步树 数据容器

继承自 Tree 一次性获取全部数据,不会异步加载子节点数据,适用于权限树这类场景。

API

Tree API

ITreeContainerBaseProps

参数类型说明默认值
keyboolean数据容器在页面内的唯一标识-
modelstring模型Key-
dataConditionstringDataStore 数据源condition,若condition=""表示使用空条件进行查询-
dataParamsstring给数据源 dataSource 携带参数。属性不需要写成表达式格式。使用对象格式的字符串,例如{ a: 1 }, 查询时会合并到查询参数search中-
dataSourcestring | ((param: any) => any)树容器获取数据来源 key, 也可以通过一个方法返回mock数据-
titlestring标题-
showboolean是否显示-
onDataLoaded(record: any) => void容器在数据获取完成后的回调-
parentFieldstring表示父级的 field key-
hasChildrenFieldstring是否有children节点 field key-
isLeafFieldstring是否是叶子节点 field key-
iconFieldstring表示icon的 field key-
searchableboolean是否开启搜索-
checkedFieldstring表示是否勾选的 field key-
asyncLoadChildrenboolean是否以同步方式加载子节点false
labelFieldstring显示的节点名称-
onSelectstring选中行数据触发 Action-
optionFormat(record: any) => string自定义节点渲染文本-
onAddRoot(({ record }: { record: string }) => void) | string内置根节点新增按钮-
onAdd(({ record }: { record: string }) => void) | string内置节点新增按钮-
onEdit({ record }: { record: { parent: any; label: string } }) => void内置编辑按钮-
onDelete({ record }: { record: any }) => void内置删除按钮-
orderFieldstring获取节点列表时的排序字段名称,配合order属性使用-
order’asc’ | ‘desc’获取节点时的排序规则,配合orderField属性使用-

移除 props asyncLoadChildren

用法

基础用法
<View title="树形容器" version="2">
<SyncTree model="trantor_doc_Tree" parentField="parent" hasChildrenField="hasChildren">
<Fields>
<Field name="name"/>
</Fields>
</SyncTree>
</View>

注意:当前例子为0.17.x 版本

操作
<View title="树形容器" version="2">
<SyncTree model="trantor_doc_Tree" parentField="parent" hasChildrenField="hasChildren">
<Fields>
<Field name="name"/>
</Fields>
<RecordActions>
<Action label="编辑" action="trantor_doc_Tree_update" />
<Action label="删除" action="trantor_doc_Tree_delete" after="Refresh" />
</RecordActions>
</SyncTree>
</View>

注意:当前例子为0.17.x 版本