wenzhixin / bootstrap-table-examples

Bootstrap table examples
https://examples.bootstrap-table.com/
MIT License
2.24k stars 1.62k forks source link

Problem with sorting negative numbers #424

Closed usmanpakistan closed 3 years ago

usmanpakistan commented 3 years ago

I was having issue with sorting negative numbers. Because the regex used below strip negative numbers and convert them to positive number. To solve this issue I have replaced the below line.. https://github.com/wenzhixin/bootstrap-table-examples/blob/cdbdbf886e42d290f6660a0a8784ca57b086c6ad/utils/natural-sorting/src/natural-sorting.js#L58

with this s = s.replace(/^(-)|[.,](?=[^.,]*[.,](?!$))|[,.]+$|[^0-9.,]+/g, '$1');

djhvscf commented 3 years ago

Good, could you provide an Online Example, thanks!

UtechtDustin commented 3 years ago

@djhvscf i guess we don't need a example here. We dropped the extension since version 1.16.0, because its quiet easy to implement itself.

But it seems we forgot to remove the example for that.

djhvscf commented 3 years ago

You're completely right

wenzhixin commented 3 years ago

You can implement it by yourself. Any PR is welcome.