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