-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree 中TreeNode从treeData取值,没办法配置相应的key及title对应的取值字段 #24282
Comments
This comment has been minimized.
This comment has been minimized.
不太明白,为什么级联组件愿意提供这个支持,树选择器就不能提供。 |
支持自定义这种还是非常有必要的,我们目前用的是ztree,id,name这种,想迁移到这个上面来,发现自己再重新包裹,加上树节点万级别,有些层级还很深,重新渲染成title这种使用起来,等于又重新渲染树了 |
为啥Cascader就有而TreeSelect就没 而且也不是说无法添加 |
强烈建议增加fieldNames |
@zombieJ 你是认真的吗 |
Can you extend |
所以是还没解决吗?关键是自己构建 treeNode 还报错。 |
为啥不支持下呢 |
伪代码: treeData= {
title: <Component />
} 不行么? |
强烈建议加,要不然也得告诉我们是什么原因导致加不了! |
Vue version of Ant has this feature https://www.antdv.com/components/tree/#components-tree-demo-replacefields |
手动添加了,唉 const convertData = (data: Array<any>) => {
data.forEach((item) => {
item.title = item.name;
item.key = item.id;
if (item.children) {
convertData(item.children);
}
});
}; |
这个真的需要支持一下 因为好多都是id name这样的,如果支持的话就很棒了 |
头疼 |
Tree/TreeSelect 可以统一支持一下,类似 Cacasder 的 fieldNames。 |
@zombieJ 能支持一下吗 如果自己处理数据的话 还要用递归 递归效率慢 加个映射很实用呀 |
呼声如此之高的一个需求 不知道现在是什么进展? |
这个需求现在支持了吗?为啥看到提这个问题的issues都被关闭了,这个需求真的很需要!很多情况下获取到的数据的字段名并不是title,value,这个需求在哪个版本能支持一下? |
同一个问题,留一个issus就好了。就是当前这个。 |
Tree、TreeSelect、Select、级联选择器我感觉都需要这个功能的 |
Hi to all (Great components BTW), is there any workaround that we can use in the meantime?.. I'm facing the same issue , I'll need to show a different field instead of the title. thanks in advanced |
Any progress? I'm facing the same issue too |
same issue here |
I also encountered this problem |
+1 |
我也遇到相同问题,可以解决一下么,都过了一年多了 |
+1 |
1 similar comment
+1 |
感觉这个功能还是很有必要的 |
这个api还没出来吗?? |
no |
See #31395 |
您好, FieldNames 属性支持修改 key为其他标志,但是 interface DataNode 对 key 是必须的,所以设置 fieldNames = { key: 'id' },仍需要向数据增加 key 属性,请问有办法解决吗 |
参考示例可解决:https://codesandbox.io/s/objective-roentgen-hkiq98?file=/src/App.tsx:43-56 |
What problem does this feature solve?
解决了从服务端加载的数据中,可以不需要特别增加字段key和title才能适配TreeNode。否则只能自己构造Tree,但是自己构造提示API已经过时,建议使用treeData
What does the proposed API look like?
<Tree treeDataField={title:'name',key:'code'} />
The text was updated successfully, but these errors were encountered: