10000 BTable: Unable to sort by child object property with sortByFormatted · Issue #2227 · bootstrap-vue-next/bootstrap-vue-next · GitHub
[go: up one dir, main page]

Skip to content
BTable: Unable to sort by child object property with sortByFormatted #2227
Closed
@hackel

Description

@hackel

Describe the bug

When sorting by a column that is an object using a formatter function, I get the exception "aValue.localeCompare is not a function". In trying to debug, it looks like an integer is being returned from the realVal function instead of a string, though I'm not sure how that's possible from looking at it.

My data looks like this: { id: 1, charges: { total: 100 } } and my formatter: charges => charges.total. See StackBlitz for simplified example.

Edit: A workaround is to cast the total charges as a string in the formatter. It would be very nice if I didn't have to do that everywhere, though.

Reproduction

https://stackblitz.com/edit/github-fwer37?file=src%2Fcomponents%2FComp.vue,src%2FApp.vue

Used Package Manager

npm

Validations

  • Have tested with the latest version. This is still alpha version and sometime things change rapidly.
  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0