update Table
update Table
This commit is contained in:
parent
35ad37642d
commit
642299b9b8
5 changed files with 110 additions and 33 deletions
|
@ -310,24 +310,26 @@
|
|||
this.cloneColumns.forEach((col) => col._sortType = 'normal');
|
||||
|
||||
const key = this.cloneColumns[index].key;
|
||||
if (type === 'asc') {
|
||||
this.rebuildData.sort((a, b) => {
|
||||
if (this.cloneColumns[index].sortMethod) {
|
||||
return this.cloneColumns[index].sortMethod(a, b);
|
||||
} else {
|
||||
return a[key] > b[key];
|
||||
}
|
||||
});
|
||||
} else if (type === 'desc') {
|
||||
this.rebuildData.sort((a, b) => {
|
||||
if (this.cloneColumns[index].sortMethod) {
|
||||
return this.cloneColumns[index].sortMethod(a, b);
|
||||
} else {
|
||||
return a[key] < b[key];
|
||||
}
|
||||
});
|
||||
} else if (type === 'normal') {
|
||||
this.rebuildData = this.makeData();
|
||||
if (this.cloneColumns[index].sortable !== 'custom') { // custom is for remote sort
|
||||
if (type === 'asc') {
|
||||
this.rebuildData.sort((a, b) => {
|
||||
if (this.cloneColumns[index].sortMethod) {
|
||||
return this.cloneColumns[index].sortMethod(a, b);
|
||||
} else {
|
||||
return a[key] > b[key];
|
||||
}
|
||||
});
|
||||
} else if (type === 'desc') {
|
||||
this.rebuildData.sort((a, b) => {
|
||||
if (this.cloneColumns[index].sortMethod) {
|
||||
return this.cloneColumns[index].sortMethod(a, b);
|
||||
} else {
|
||||
return a[key] < b[key];
|
||||
}
|
||||
});
|
||||
} else if (type === 'normal') {
|
||||
this.rebuildData = this.makeData();
|
||||
}
|
||||
}
|
||||
|
||||
this.cloneColumns[index]._sortType = type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue