0👍
✅
This can be achieved using the custom-sort prop. You’ll have to manually handle the sorting of every column type, but you’ll have complete control over whether to sort or not sort based on some other state in your component or app.
See this updated codepen (when sorting it only does the number type columns correctly, but it’s also not meant to be a complete example)
customSort(items, index, isDesc) {
if (this.isLoading) {
return items;
}
items.sort((a, b) => {
if (isDesc != 'false') {
return a[index] < b[index] ? -1 : 1;
} else {
return b[index] < a[index] ? -1 : 1;
}
});
return items;
}
Source:stackexchange.com