Fixed #216 - sortfield is ignored

pull/227/head
cagataycivici 2020-03-03 12:25:27 +03:00
parent df1e8d2d32
commit 51206b79ed
1 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ export default {
}, },
methods: { methods: {
getColumnHeaderClass(column) { getColumnHeaderClass(column) {
const sorted = this.sortMode === 'single' ? (this.sortField === column.field || this.sortField === column.sortField) : this.getMultiSortMetaIndex(column) > -1; const sorted = this.sortMode === 'single' ? (this.sortField && (this.sortField === column.field || this.sortField === column.sortField)) : this.getMultiSortMetaIndex(column) > -1;
return [column.headerClass, return [column.headerClass,
{'p-sortable-column': column.sortable}, {'p-sortable-column': column.sortable},
@ -99,7 +99,7 @@ export default {
let sortOrder = null; let sortOrder = null;
if (this.sortMode === 'single') { if (this.sortMode === 'single') {
sorted = (this.sortField === column.field || this.sortField === column.sortField); sorted = this.sortField && (this.sortField === column.field || this.sortField === column.sortField);
sortOrder = sorted ? this.sortOrder: 0; sortOrder = sorted ? this.sortOrder: 0;
} }
else if (this.sortMode === 'multiple') { else if (this.sortMode === 'multiple') {
@ -123,7 +123,7 @@ export default {
for (let i = 0; i < this.multiSortMeta.length; i++) { for (let i = 0; i < this.multiSortMeta.length; i++) {
let meta = this.multiSortMeta[i]; let meta = this.multiSortMeta[i];
if (meta.field === (column.field || column.sortField)) { if (meta.field === column.field || meta.field === column.sortField) {
index = i; index = i;
break; break;
} }