-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
<b-table> Select all, clear selected #3064
Comments
We could possibly add a method on the table instance that would clear the selected rows by replacing the internal selected reference with and empty array |
The main reason for treating the selected rows as readonly is because reactive changes will cause the table to re-re-render, which can cause UI issues for the user (i.e. if there is an input in the table and their cursor is in one spot, the re-render can cause their cursor to jump to another location within the input, etc). |
For the bulk update, you would need to call, after you have updated the source of truth for your items, the table |
I can totally understand about not re-re-rendering the table when this data changes. Thanks for the info about the |
You can "select all" and "clear all" by using the The shortcut I use select all/deselect all (with two clicks) is:
Still a workaround for having "selected" be reactive though 😉 Edit: See this snippet |
A small workaround for deselecting all:
At the beginning of the rowSelected(items) method just add:
THis works quite nice. |
There is an undocumented table method that you can call to clear the current table section. Make sure your table has a <b-table ref="mytable" selectable .... > then in your code you can call this to clear hte selection: this.$refs.mytable.clearSelected() this will clear the current selected rows. |
I'll also vote for an official method to select all rows of a table. |
BootstrapVue v2.0.0-rc.28 has been released. |
I've just updated my application to use the 'selectable' mode on b-table and it's great. The only down side (and as stated in the docs) is that the selected rows are read-only. Right now I'm using the selected rows as a synced prop to the parent so that it can pass those rows to a 'bulk' actions component. There's just no way to have the 'bulk actions' component tell the table to update the selected rows.
My feature suggestion is to add a method for selecting/unselecting all rows in b-table.
Only selecting/unselecting rows on the current page is fine for my use case. Using $refs to trigger this on the table could work. Maybe even another method for replacing the selected rows array?
Thanks for all the hard work!
The text was updated successfully, but these errors were encountered: