Describe the bug
When the item data for a column contains strings that represent numerical values, the sorting behavior is as expected, but only if no negative values are included.
Steps to reproduce the bug
- Go to https://bootstrap-vue.org/docs/components/table#sorting
- In the Live data, change the
items to this (note that the age values are strings):
items: [
{ isActive: true, age: "20", first_name: 'Dickerson', last_name: 'Macdonald' },
{ isActive: false, age: "100", first_name: 'Larsen', last_name: 'Shaw' },
{ isActive: false, age: "1", first_name: 'Geneva', last_name: 'Wilson' },
{ isActive: true, age: "-1", first_name: 'Linus', last_name: 'Carney' },
{ isActive: true, age: "-100", first_name: 'Sally', last_name: 'Carney' },
{ isActive: true, age: "-20", first_name: 'Schroeder', last_name: 'Carney' },
]
- Click the
Age table header twice to sort in descending order:

- The age values, even though strings, are sorted as numbers -- i.e. this is not a dictionary sort (i.e. "20", "100", "1" for a descending sort). But the negative values are in reversed order from what they ought to be.
Expected behavior
The sorted values should be 100, 20, 1, -1, -20, -100, i.e. in decreasing numerical order.
Versions
Libraries:
- BootstrapVue: 2.19.0
- Bootstrap: 4.5.3
- Vue: 2.6.11
Environment:
- Device: Mac
- OS: macOS Catalina
- Browser: Chrome
- Version: 86.0.4240.198
Additional context
I'm quite happy that the sorting is smart enough to recognize that "100" is a number -- I'd just like it to work correctly with negative numbers, too.
Describe the bug
When the item data for a column contains strings that represent numerical values, the sorting behavior is as expected, but only if no negative values are included.
Steps to reproduce the bug
itemsto this (note that theagevalues are strings):Agetable header twice to sort in descending order:Expected behavior
The sorted values should be 100, 20, 1, -1, -20, -100, i.e. in decreasing numerical order.
Versions
Libraries:
Environment:
Additional context
I'm quite happy that the sorting is smart enough to recognize that "100" is a number -- I'd just like it to work correctly with negative numbers, too.