Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion news/2 Fixes/5414.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix sorting of lists.
Fix sorting of lists with numbers and missing entries.
4 changes: 2 additions & 2 deletions src/datascience-ui/data-explorer/mainPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
// or it will take too long
const comparer = isStringColumn ?
(a: any, b: any): number => {
const aVal = a[sortColumn].toString();
const bVal = b[sortColumn].toString();
const aVal = a[sortColumn] ? a[sortColumn].toString() : '';
Copy link
Member

@IanMatthewHuff IanMatthewHuff Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible falsy if there is a 0 in a mixed column of strings and ints. #WontFix

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works with '' or 0 as they sort the same.


In reply to: 277482170 [](ancestors = 277482170)

const bVal = b[sortColumn] ? b[sortColumn].toString() : '';
const aStr = aVal ? aVal.substring(0, Math.min(aVal.length, MaxStringCompare)) : aVal;
const bStr = bVal ? bVal.substring(0, Math.min(bVal.length, MaxStringCompare)) : bVal;
const result = aStr > bStr ? -1 : 1;
Expand Down