Skip to content

Commit

Permalink
Merge pull request #5615 from Laravel-Backpack/update-column-priority…
Browse files Browse the repository at this point in the history
…-on-move

Update column priority on move
  • Loading branch information
pxpm authored Aug 16, 2024
2 parents 3539cc0 + 6e12557 commit 016c8bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ protected function moveColumn($targetColumn, $before = true)
array_search($targetColumnName, array_keys($columnsArray)) + 1;

$element = array_pop($columnsArray);

if ($element['priority'] === count($columnsArray)) {
// the priority was most likely auto-set as it corresponds to the column array count
// update the priority to the target column position
$element['priority'] = $targetColumnPosition;
}

$beginningPart = array_slice($columnsArray, 0, $targetColumnPosition, true);
$endingArrayPart = array_slice($columnsArray, $targetColumnPosition, null, true);

Expand Down

0 comments on commit 016c8bc

Please sign in to comment.