From 12a4d2a930ec32cf43201cfba75de8c21363cec3 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 3 Mar 2020 12:14:30 +0300 Subject: [PATCH] Fixed #216 - sortfield is ignored --- src/components/datatable/DataTable.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index 08f2fd7c3..b40e08630 100644 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -465,7 +465,7 @@ export default { if (column.sortable) { const targetNode = event.target; - const columnField = column.field || column.sortField; + const columnField = column.sortField || column.field; if (DomHandler.hasClass(targetNode, 'p-sortable-column') || DomHandler.hasClass(targetNode, 'p-column-title') || DomHandler.hasClass(targetNode, 'p-sortable-column-icon') || DomHandler.hasClass(targetNode.parentElement, 'p-sortable-column-icon')) { @@ -499,6 +499,7 @@ export default { data.sort((data1, data2) => { let value1 = ObjectUtils.resolveFieldData(data1, this.d_sortField); let value2 = ObjectUtils.resolveFieldData(data2, this.d_sortField); + let result = null; if (value1 == null && value2 != null)