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
Closed

B-Table selectable #3901

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

Comments

@XpamAmAdEuS
Copy link

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants