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

In el-table, <el-table-column type="index"></el-table-column> and <el-table-column type="expand"> < /el-table-column> are used. When expand is expanded, the index sorting error occurs #1919

Closed
Buttii opened this issue Apr 29, 2021 · 3 comments · Fixed by #1983
Assignees

Comments

@Buttii
Copy link

Buttii commented Apr 29, 2021

https://codesandbox.io/s/element-plus-spa-forked-9zho8?file=/src/App.vue

@element-bot element-bot changed the title el-table中使用<el-table-column type="index"></el-table-column>和<el-table-column type="expand"></el-table-column>,当expand展开,index排序出错 In El table, < El table column type = "index" > < / El table column > and < El table column type = "expand" > < / El table column > are used. When expand is expanded, the index sorting error occurs Apr 29, 2021
@element-bot
Copy link
Member

Translation of this issue:

[ https://codesandbox.io/s/element-plus-spa-forked-9zho8? file=/src/App.vue]( https://codesandbox.io/s/element-plus-spa-forked-9zho8? file=/src/App.vue)

@Buttii Buttii changed the title In El table, < El table column type = "index" > < / El table column > and < El table column type = "expand" > < / El table column > are used. When expand is expanded, the index sorting error occurs In el-table, <el-table-column type="index"></el-table-column> and <el-table-column type="expand"> < /el-table-column> are used. When expand is expanded, the index sorting error occurs Apr 29, 2021
@justwiner justwiner self-assigned this May 7, 2021
justwiner pushed a commit to justwiner/element-plus that referenced this issue May 11, 2021
@justwiner justwiner mentioned this issue May 11, 2021
3 tasks
@Buttii Buttii closed this as completed May 12, 2021
justwiner pushed a commit to justwiner/element-plus that referenced this issue May 13, 2021
jw-foss pushed a commit that referenced this issue May 21, 2021
fix #1919

Co-authored-by: winerlu <winerlu@tencent.com>
@Buttii Buttii reopened this May 31, 2021
@Buttii
Copy link
Author

Buttii commented May 31, 2021

上面的问题解决了,但又出现了新的问题,当el-table设置row-key属性时,type="index"的el-table-column页面显示全部为1。
https://codesandbox.io/s/element-plus-spa-forked-fzgs4?file=/src/App.vue

@yaohzone
Copy link

yaohzone commented Jun 1, 2021

翻看源码发现很奇怪的逻辑:

this.wrappedRowRender(
    row,
    acc.filter(item => typeof item.key === 'number').length,
)`

源码
查看这里item.key值,如果设置row-key就是该字段提供值,为非数值时就会产生类似BUG,即$index全为0,而且如果包含fixed列,hover项也一直是第一项(0)。
这是我目前发线的BUG...但暂时没时间细看,望能尽快解决。

@Buttii Buttii closed this as completed Jun 7, 2021
msidolphin pushed a commit to msidolphin/element-plus that referenced this issue Jun 12, 2021
msidolphin pushed a commit to msidolphin/element-plus that referenced this issue Jun 12, 2021
msidolphin pushed a commit to msidolphin/element-plus that referenced this issue Jun 19, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants