ElemeFE / ElemeFE/element-react

"defaultExpandAll" of table don't take effect when the data is empty initially

Open
#1,022 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

### Description

The Table property "defaultExpandAll" will expand all columns whose type is "type". However, when the table data is empty initially, this function don't take effect.

I found that, every time you rerender the Table, this "expand all" function don't take effect.

### Reproduce Steps

```
const columns = [
{
type: 'expand',
expandPannel: function(data: any){
return (

aaa

)
}
}
const data = []
return (
)
```
Now `data` is an empty array. If we fetch data from backend system and fill `data` array, then rerender the component, the "expand all" function won't take effect.

### Solution

Currently, I use this code to fix this problem.
```
return ({data.length > 0 && }
)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.