frappe/datatable

[bug] sorting on a column is broken if some of the cells are `undefined`

igrekus opened this issue · 1 comments

Undefined cell breaks the whole column into sorted sequences:

Descending:
image

Ascending:
image

Highlighted cell is undefined in the sample data array:

data = [
	["Tiger Nixon", { content: "System Architect<br>New line", editable: false }, "Edinburgh", 1, "2011/04/25", 320800],
	["Garrett Winters", "Accountant", "Tokyo", 2, "2011/07/25", 170750],
	["Ashton Cox", "Junior Technical Author", "San Francisco", 3, "2009/01/12", 86000],
	["Cedric Kelly", "Senior Javascript Developer", "Edinburgh", undefined, "2012/03/29", 433060],
	["Airi Satou", "Accountant", "Tokyo", 8, "2008/11/28", 162700],
	["Brielle Williamson", "Integration Specialist", "New York", 5, "2012/12/02", 372000],
	["Herrod Chandler", "Sales Assistant", "San Francisco", '', "2012/08/06", 137500]
];

If the 'empty' cell is represented with an emptystring, sorting works correctly.

This is an issue when Datatable is used in the reports infrastructure within Frappe since all of the NULL values in the database are undefined in the table data.

Closing, fixed in 4cfd0be