Fix move column left and right not working
This commit is contained in:
parent
e0c38d7fbe
commit
c4748d5cd6
|
@ -18,7 +18,7 @@
|
||||||
isReordering,
|
isReordering,
|
||||||
isResizing,
|
isResizing,
|
||||||
sort,
|
sort,
|
||||||
visibleColumns,
|
scrollableColumns,
|
||||||
dispatch,
|
dispatch,
|
||||||
subscribe,
|
subscribe,
|
||||||
config,
|
config,
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
$: sortedBy = column.name === $sort.column
|
$: sortedBy = column.name === $sort.column
|
||||||
$: canMoveLeft = orderable && idx > 0
|
$: canMoveLeft = orderable && idx > 0
|
||||||
$: canMoveRight = orderable && idx < $visibleColumns.length - 1
|
$: canMoveRight = orderable && idx < $scrollableColumns.length - 1
|
||||||
$: sortingLabels = getSortingLabels(column.schema?.type)
|
$: sortingLabels = getSortingLabels(column.schema?.type)
|
||||||
$: searchable = isColumnSearchable(column)
|
$: searchable = isColumnSearchable(column)
|
||||||
$: resetSearchValue(column.name)
|
$: resetSearchValue(column.name)
|
||||||
|
|
|
@ -226,10 +226,10 @@ export const createActions = context => {
|
||||||
const moveColumnLeft = async column => {
|
const moveColumnLeft = async column => {
|
||||||
const $visibleColumns = get(visibleColumns)
|
const $visibleColumns = get(visibleColumns)
|
||||||
const $columnLookupMap = get(columnLookupMap)
|
const $columnLookupMap = get(columnLookupMap)
|
||||||
const sourceIdx = $columnLookupMap[column]
|
const sourceIdx = $columnLookupMap[column].__idx
|
||||||
await moveColumn({
|
await moveColumn({
|
||||||
sourceColumn: column,
|
sourceColumn: column,
|
||||||
targetColumn: $visibleColumns[sourceIdx - 2]?.name,
|
targetColumn: $visibleColumns[sourceIdx - 1]?.name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,13 +237,14 @@ export const createActions = context => {
|
||||||
const moveColumnRight = async column => {
|
const moveColumnRight = async column => {
|
||||||
const $visibleColumns = get(visibleColumns)
|
const $visibleColumns = get(visibleColumns)
|
||||||
const $columnLookupMap = get(columnLookupMap)
|
const $columnLookupMap = get(columnLookupMap)
|
||||||
const sourceIdx = $columnLookupMap[column]
|
const sourceIdx = $columnLookupMap[column].__idx
|
||||||
if (sourceIdx === $visibleColumns.length - 1) {
|
if (sourceIdx === $visibleColumns.length - 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await moveColumn({
|
await moveColumn({
|
||||||
sourceColumn: column,
|
sourceColumn: column,
|
||||||
targetColumn: $visibleColumns[sourceIdx + 1]?.name,
|
targetColumn: $visibleColumns[sourceIdx + 1]?.name,
|
||||||
|
insertAfter: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue