AllenFang / AllenFang/react-bootstrap-table

Sorting of undefined properties causes undefined result

Đang mở
#1,017 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement in progress
Ngôn ngữ chính
JavaScript
Star
2.2k
Fork
761
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In my data, some records are missing a property that I display in a sortable column.

I assume this results in the value used for comparisons being `undefined` which messes up sorting. Strangely enough, Chrome still sorts as unexpected but Firefox messes up.

I already did some browsing and found that `null` is handled specially but not `undefined`
https://github.com/AllenFang/react-bootstrap-table/blob/master/src/store/TableDataStore.js#L565

I guess its because the comparison operators `<` and `>` cause unexpected results in combination with `undefined` operands, e.g.:
```javascript
"a" < undefined
false

undefined < "a"
false
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.