Fix error when clicking on header for tables with no rows (#12408)

This commit is contained in:
Charles Gagnon
2020-09-17 14:54:58 -07:00
committed by GitHub
parent ee523fb512
commit cac686b9e6

View File

@@ -15,7 +15,7 @@ export interface IFindPosition {
}
function defaultSort<T extends { [key: string]: any }>(args: Slick.OnSortEventArgs<T>, data: Array<T>): Array<T> {
if (!args.sortCol || !args.sortCol.field) {
if (!args.sortCol || !args.sortCol.field || data.length === 0) {
return data;
}
const field = args.sortCol.field;