AllenFang / AllenFang/react-bootstrap-table

Sorting of undefined properties causes undefined result

未关闭
#1,017 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement in progress
主要语言
JavaScript
星标
2.2k
派生
761
PR 合并指标
30 天内没有已合并 PR

描述

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
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。