dwqs / v2-table

A simple table component based Vue 2.x: https://dwqs.github.io/v2-table/
MIT License
100 stars 24 forks source link

Is there a way to set specific rows to be checked? #6

Closed kevinding0218 closed 6 years ago

kevinding0218 commented 6 years ago

Hello I've been using the v2-table for some design purpose but I could not figure out a way to bind the checked attribute of column with type "selection", so I cannot set some rows to be selected programmably, I've tried using "prop" attribute but it won't work... e.g:

data: [{checked: true, name: 'jason', state:'CA'}, {checked: false, name: 'mike', state:'CA'}, {checked: true, name: 'Lu', state:'CA'},...] Do you have any example upon this functionality?

Thank you very much for your help!

Best,

dwqs commented 6 years ago

Not supports this feature......I will implement it as soon as possible

dwqs commented 6 years ago

Upgrade to 1.2.2, and call toggleRowSelection to change the row selection status.

<v2-table ref="table" :data="rows">
 // ...
</v2-table>

 this.$refs.table.toggleRowSelection(this.rows[0], [selected])   // selected is optional

See toggleRowSelection