Reputation: 57
I have a problem. I want to display selection according to the condition.
Here is the example. I want to hide the selection for the name 'Jeff'
http://jsfiddle.net/8y5cnk1p/2/
If I try to use 'v-if'
<el-table-column type="selection" width="45" v-if="name != 'Jeff'" </el-table-column>
It doesn't work. How?
Thanks!
Upvotes: 2
Views: 7708
Reputation: 140
You can display the column of checkbox.
<el-table-column
v-if="isShow"
:key="Math.random()"
type="selection"
width="45">
</el-table-column>
Don't forget the "key" !!!
Upvotes: 0
Reputation: 10076
You can't hide the checkbox, but you can disable it using selectable
attribute:
<el-table-column type="selection"
width="45"
:selectable="canSelectRow">
</el-table-column>
methods: {
canSelectRow(row, index) {
return row.name !== 'Jeff';
}
}
Docs: Table Column Attributes
Upvotes: 8