Skip to content
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

[Bug Report] tree-table How to cancel tree render. #14905

Closed
xlz26296 opened this issue Mar 29, 2019 · 8 comments
Closed

[Bug Report] tree-table How to cancel tree render. #14905

xlz26296 opened this issue Mar 29, 2019 · 8 comments

Comments

@xlz26296
Copy link

Element UI version

2.7.0

OS/Browsers version

Google Chrome

Vue version

2.6.10

Reproduction Link

https://codepen.io/anon/pen/vPowem?&editable=true

Steps to reproduce

非树结构的数据中带有children字段,直接报错了
Error: if there's nested data, rowKey is required.

What is Expected?

非树结构的数据中带有children字段,希望能关闭树渲染方式

What is actually happening?

非树结构的数据中带有children字段,直接报错了

@element-bot
Copy link
Member

Translation of this issue:

Element UI version

2.7.0

OS/Browsers version

Google Chrome

Vue version

2.6.10

Reproduction Link

https://codepen.io/anon/pen/vPowem?&editable=true

Steps to reproduce

Non-tree data with children field, direct error reporting

Error: if there's nested data, rowKey is required.

What is Expected?

Non-tree data with child fields, hoping to close tree rendering

What is actually happening?

Non-tree data with children field, direct error reporting

@xiaoqi0912
Copy link

官方文档还没给出回复, 可以先给children 改个名字

@caoyang1203
Copy link

/**
      * element 2.7 中的 table 组件会自动探测数据中 children 字段,如果有会按照 tree 的方式去渲染

  * 这里我们不需要渲染成 tree 的方式,但是官方还未提供取消 tree 渲染的方式
  * 所以这里手动将数据中的 children 字段改为了 childrens,这样 element 就不会当做 tree 的方式去渲染了
* 后期官方应该会提供取消按照默认字段 children 进行 tree 渲染的功能
*/
data.forEach(item => {
item.childrens = item.children
delete item.children
})

@xlz26296
Copy link
Author

是可以换字段解决,但是原有的项目中很多表格带有 children 字段,如果要改动涉及比较多,只能先不升级了

@x-song
Copy link

x-song commented Apr 3, 2019

请问下2.0以上哪个版本是没有这个问题的,试过2.5.4版本还是会存在这问题

@iamkun
Copy link
Member

iamkun commented Apr 8, 2019

#14910

@iamkun iamkun closed this as completed Apr 8, 2019
@gogo1008
Copy link

官网这个功能兼容是很好的;但是向下兼容也需要,至少需要一个开关,如果关闭,就不需要使用官网的树;这个还请尽快更新

@minteliuwm
Copy link

请问下2.0以上哪个版本是没有这个问题的,试过2.5.4版本还是会存在这问题

你看看是不是npm install的时候安装的版本不是2.5.4,我之前2.5.4没问题,然后今天把node_modules目录删了,重新install就出问题了,最后发现安装的是2.7.2版本的。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants