Sort columns to put autocolumns last
This commit is contained in:
parent
0c53e06267
commit
11dd5fc805
|
@ -63,20 +63,30 @@ export const createColumnsStores = context => {
|
||||||
|
|
||||||
// Update columns, removing extraneous columns and adding missing ones
|
// Update columns, removing extraneous columns and adding missing ones
|
||||||
columns.set(
|
columns.set(
|
||||||
fields.map(field => {
|
fields
|
||||||
// Check if there is an existing column with this name so we can keep
|
.map(field => {
|
||||||
// the width setting
|
// Check if there is an existing column with this name so we can keep
|
||||||
let existing = currentColumns.find(x => x.name === field)
|
// the width setting
|
||||||
if (!existing && currentStickyColumn?.name === field) {
|
let existing = currentColumns.find(x => x.name === field)
|
||||||
existing = currentStickyColumn
|
if (!existing && currentStickyColumn?.name === field) {
|
||||||
}
|
existing = currentStickyColumn
|
||||||
return {
|
}
|
||||||
name: field,
|
return {
|
||||||
width: existing?.width || DefaultColumnWidth,
|
name: field,
|
||||||
schema: schema[field],
|
width: existing?.width || DefaultColumnWidth,
|
||||||
visible: existing?.visible ?? true,
|
schema: schema[field],
|
||||||
}
|
visible: existing?.visible ?? true,
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
.sort((a, b) => {
|
||||||
|
// Sort columns to put auto columns last
|
||||||
|
let autoColA = a.schema?.autocolumn
|
||||||
|
let autoColB = b.schema?.autocolumn
|
||||||
|
if (autoColA === autoColB) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return autoColA ? 1 : -1
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update sticky column
|
// Update sticky column
|
||||||
|
|
Loading…
Reference in New Issue