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

comp(mdTable): nextTick selection data #1874

Merged
merged 4 commits into from
Jul 26, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/MdTable/MdTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
},
mdSelectedValue () {
this.syncSelectedValue()
},
value () {
this.syncSelectedValue()
}
},
methods: {
Expand Down Expand Up @@ -332,7 +335,8 @@
this.$emit('update:mdSelectedValue', val)
this.$emit('md-selected', val)
},
syncSelectedValue () {
syncSelectedValue: async function () {
await this.$nextTick() // render the table first
Copy link
Member

Choose a reason for hiding this comment

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

As @Samuell1 said #1874 (comment)
would you change it to this.$nextTick(() => { /* ... code here */ })?

Additionally, I think this $nextTick could be removed with this fix.
https://github.com/rayfoss/vue-mater/blob/42ce8fcc2ebf38986d9d09d5cf296ecce93212d3/src/components/MdTable/MdTable.vue#L357

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right about the created() -> nextTick(), it became superfluous and the bug fix still works on all cases without it.

if (this.MdTable.selectingMode === 'single') {
this.MdTable.singleSelection = this.mdSelectedValue
} else if (this.MdTable.selectingMode === 'multiple') {
Expand Down