Skip to content

b-table sticky header broken if sortable #6961

@sebastian-raubach

Description

@sebastian-raubach

Describe the bug

When using b-table with the sticky-header prop and sortable columns, the stickyness of those columns is broken.

Changing the example on https://bootstrap-vue.org/docs/components/table#sticky-headers to this, shows the problem:

<template>
  <div>
    <b-table sticky-header :fields="columns" :items="items" head-variant="light"></b-table>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        columns: [{ key: 'heading1', sortable: true }, { key: 'heading2', sortable: false }],
        items: [
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' },
          { heading1: 'table cell', heading2: 'table cell', heading3: 'table cell' }
        ]
      }
    }
  }
</script>

Steps to reproduce the bug

  1. Go to https://bootstrap-vue.org/docs/components/table#sticky-headers
  2. Double click the live code section
  3. Paste in above code
  4. Scroll table down to see only one header being sticky

Expected behavior

All headers should be sticky.

Versions

Libraries:

  • BootstrapVue: 2.22.0
  • Bootstrap: 4.6.1
  • Vue: 2.6.14

Environment:

  • Device: Any
  • OS: Windows, Android
  • Browser: Chrome
  • Version: 100.0.4896.127

Demo link

See description above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions