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
Closed

B-Table selectable #3901

XpamAmAdEuS opened this issue Aug 16, 2019 · 1 comment

Comments

@XpamAmAdEuS
Copy link

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

@tmorehouse tmorehouse 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

Loading

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

Successfully merging a pull request may close this issue.

3 participants