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

Table: fix data is null and rowKey or defaultExpandAll error. #16303

Closed
wants to merge 3 commits into from

Conversation

PolanZ
Copy link

@PolanZ PolanZ commented Jun 28, 2019

Table

  • fix data is null and rowKey or defaultExpandAll error.
  • fix toggleTreeExpansion method lack of rigorous judgement.

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow Element's contributing guide (中文 | English | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer relative issues for you PR.

       fix toggleTreeExpansion method lack of rigorous judgement.
@element-bot
Copy link
Member

element-bot commented Jun 28, 2019

Deploy preview for element ready!

Built with commit dedea38

https://deploy-preview-16303--element.netlify.com

@ziyoung ziyoung self-requested a review July 1, 2019 07:47
@island205
Copy link
Contributor

related #16304

@luckyCao luckyCao added this to the 2.11.0 milestone Jul 2, 2019
@ziyoung ziyoung self-assigned this Jul 4, 2019
@@ -13,6 +13,7 @@ export default {
methods: {
updateExpandRows() {
const { data = [], rowKey, defaultExpandAll, expandRows } = this.states;
if (!data) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么加这一行呢?

const oldExpanded = treeData[id].expanded;
if (id && data && ('expanded' in data)) {
if (id && ('expanded' in data)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码可以优化一下

- const oldExpanded = treeData[id].expanded;
+ const oldExpanded = data.expanded;

并且这一行还可以移到 if 语句中。

@PolanZ PolanZ closed this Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] Table to toggleRowExpansion Method Console Error Reporting
5 participants