FE-Driver / vue-beauty

Beautiful UI components build with vue and ant design
https://fe-driver.github.io/vue-beauty
MIT License
2.11k stars 249 forks source link

Get List of all currently selected Items in the Table #257

Closed KrishnaPG closed 6 years ago

KrishnaPG commented 6 years ago

How to get the list of all currently selected items in the table?

I have a menu item that need to be enabled/disabled based on if the current selection is empty or not.

Looking for something like this:

<v-data-table stripe check-type="checkbox" @on-selection-change="s => {this.fullTblSelection = s}">...</v-data-table>

...
<span class="toolbarItem" v-bind:class="{disabled: !fullTblSelection.length}" >Claim</span>

The toolbarItem need to be enabled or disabled based on the current table selection being empty or not. Without an on select changed event giving the full table selection list, this becomes very difficult.

The component is already maintaining rowSelectionStates value to keep track of the current active selection. This full list need to be sent to the parent in an event. Currently the clickRow event only gives the current row's click state. Not the full list of selected items.

yuu2lee4 commented 6 years ago

Currently, you can only maintenance a selected Items by clickRow event,it has 3 parammeters: 1、index: Number - the row index 2、checked: Boolean - checked or not 3、rowData: Object - row data The reason we didn't offer the selected Items data is data-table has pagination, it's hard to maintenance the list.