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

default-sort doesn't set currentSortColumn #1126

Closed
NERDYLIZARD opened this issue Dec 17, 2018 · 4 comments
Closed

default-sort doesn't set currentSortColumn #1126

NERDYLIZARD opened this issue Dec 17, 2018 · 4 comments
Assignees
Labels

Comments

@NERDYLIZARD
Copy link

I set default -sort prop as :default-sort="['date', 'desc']", however, once the table is rendered, the date column is not sorted descendingly. When I checked in vue dev tool, the <BTable>, it has currentSortColumn as empty and stay empty until I click on a sortable column.

How do I set default sort column and its direction correctly?

code sample

<template>
  <div class="report">
    <h2 class="header">Report</h2>
    <b-table
      :columns="columns"
      :data="data"
      default-sort-direction="asc"
      :default-sort="['date', 'desc']">
    </b-table>
  </div>
</template>

<script>
  export default {
    name: 'Report',
    components: {},
    data () {
      const data = [{
        amount: 100,
        ccy: 'LAK',
        description: 'AOrange Juice',
        fccref: '010FTBP183397379',
        name: 'Narin Bhommaraj',
        date: '04/12/2018',
      }, {
        amount: 200,
        ccy: 'USB',
        description: 'BOrange Juice',
        fccref: '010FTBP183397379',
        name: 'Narin Bhommaraj',
        date: '05/12/2018',
      }, {
        amount: 300,
        ccy: 'THB',
        description: 'COrange Juice',
        fccref: '010FTBP183397379',
        name: 'Narin Bhommaraj',
        date: '06/12/2018',
      }, {
        amount: 400,
        ccy: 'LAK',
        description: 'DOrange Juice',
        fccref: '010FTBP183397379',
        name: 'Narin Bhommaraj',
        date: '07/12/2018',
      }]


      return {
        columns: [
          { label: 'Date', field: 'date', sortable: true },
          { label: 'Description', field: 'description', sortable: true },
          { label: 'Currency', field: 'ccy', sortable: true },
          { label: 'Amount', field: 'amount', sortable: true },
          { label: 'Customer', field: 'name', sortable: true },
          { label: 'FCCREF', field: 'fccref' },
        ],
        data,
      }
    },
</script>

vue devtool
untitled

@jtommy jtommy added the bug label Dec 19, 2018
@jtommy jtommy self-assigned this Dec 19, 2018
@jtommy jtommy closed this as completed in 19ec350 Dec 19, 2018
@NERDYLIZARD
Copy link
Author

The bug persist. Do I need to pull any new version? The current version is ^0.7.1.

@jtommy
Copy link
Member

jtommy commented Jan 4, 2019

It will be released in the 0.7.2 (next version)

@NERDYLIZARD
Copy link
Author

Thank you. When is the next release?

@jtommy
Copy link
Member

jtommy commented Jan 4, 2019

I think next week

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

No branches or pull requests

2 participants