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

B-Table selectable #3901

Closed
XpamAmAdEuS opened this issue Aug 16, 2019 · 1 comment · Fixed by #3907

Comments

@XpamAmAdEuS
Copy link

commented Aug 16, 2019

Is it possible to use b-form-checkbox for selecting/unselecting rows?

Also selectall/unselect all in head using b-form-checkbox.

Can u plz provide example Thx.

@tmorehouse

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

For select and unslect all, there are two methods available that you can tie to click handlers (or similar)

<template>
  <b-table ref="myTable" .... >
    <!-- slots here -->
  </b-table>
</template>
<script>
export default {
  methods: {
    selectAll() {
      // Selet all rows
      this.$refs.myTable.selectAllRows()
    },
    unselectAll() {
      /// unselect all rows
      this.$refs.myTable.clearSelected()
    }
  }
}
</script>

Since row selection/deselection are click driven (it listened for row-clicked events), you can place a disabled checkbox in each row, that is tied to the row's scoped property rowSelected. teh checkbox would need to be disabled in order to allow the click on the chekbox to fallthough the input into the row. So basically the checkbox is presentational only (so you should probably put the attribute aria-hidden="true" on the checkbox

jackmu95 added a commit that referenced this issue Aug 17, 2019
feat(b-table): add `selectAllRows()` and `clearSelected()` to thead/t…
…foot slot scopes (addresses #3901) (#3907)

* feat(b-table): add `selectAllRows()` and `clearSelected()` to thead slot scopes

* Update mixin-thead.js

* Update README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.