mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: Fix sorter across different components (#8046)
This PR fixes sorting in tables by columns in the UI
This commit is contained in:
parent
b58ffec4cd
commit
66e5d41a15
@ -155,7 +155,7 @@ export default {
|
||||
key: columnKey,
|
||||
title: this.$t('label.' + String(columnKey).toLowerCase()),
|
||||
dataIndex: columnKey,
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => { return genericCompare(a[columnKey] || '', b[columnKey] || '') }
|
||||
})
|
||||
}
|
||||
if (this.columns.length > 0) {
|
||||
|
||||
@ -861,7 +861,7 @@ export default {
|
||||
key: key,
|
||||
title: this.$t('label.' + String(title).toLowerCase()),
|
||||
dataIndex: key,
|
||||
sorter: function (a, b) { return genericCompare(a[key] || '', b[key] || '') }
|
||||
sorter: (a, b) => genericCompare(a[key] || '', b[key] || '')
|
||||
})
|
||||
this.selectedColumns.push(key)
|
||||
}
|
||||
|
||||
@ -76,17 +76,17 @@ export default {
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: this.$t('label.name'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.name || '', b?.name || '')
|
||||
},
|
||||
{
|
||||
dataIndex: 'type',
|
||||
title: this.$t('label.type'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.type || '', b?.type || '')
|
||||
},
|
||||
{
|
||||
dataIndex: 'description',
|
||||
title: this.$t('label.description'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.description || '', b?.description || '')
|
||||
}
|
||||
],
|
||||
selectedRowKeys: [],
|
||||
|
||||
@ -79,7 +79,7 @@ export default {
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: this.$t('label.name'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') },
|
||||
sorter: (a, b) => genericCompare(a?.name || '', b?.name || ''),
|
||||
width: '40%'
|
||||
},
|
||||
{
|
||||
|
||||
@ -151,7 +151,7 @@ export default {
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: this.$t('label.name'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') },
|
||||
sorter: (a, b) => genericCompare(a?.name || '', b?.name || ''),
|
||||
width: '40%'
|
||||
},
|
||||
{
|
||||
|
||||
@ -135,18 +135,18 @@ export default {
|
||||
this.columns.push({
|
||||
dataIndex: 'name',
|
||||
title: this.$t('label.hypervisor'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.name || '', b?.name || '')
|
||||
})
|
||||
|
||||
this.columns.push({
|
||||
dataIndex: 'hosts',
|
||||
title: this.$t('label.hosts'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.hosts || '', b?.hosts || '')
|
||||
})
|
||||
this.columns.push({
|
||||
dataIndex: 'cpusockets',
|
||||
title: this.$t('label.cpu.sockets'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.cpusockets || '', b?.cpusockets || '')
|
||||
})
|
||||
|
||||
this.items = []
|
||||
|
||||
@ -183,13 +183,13 @@ export default {
|
||||
this.columns.push({
|
||||
dataIndex: 'name',
|
||||
title: this.$t('label.name'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.name || '', b?.name || '')
|
||||
})
|
||||
|
||||
this.columns.push({
|
||||
dataIndex: 'value',
|
||||
title: this.$t('label.value'),
|
||||
sorter: function (a, b) { return genericCompare(a[this.dataIndex] || '', b[this.dataIndex] || '') }
|
||||
sorter: (a, b) => genericCompare(a?.value || '', b?.value || '')
|
||||
})
|
||||
},
|
||||
getRowClassName (record, index) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user