Skip to content

Commit 9d16ea8

Browse files
georgehristovDarkSide666
authored andcommitted
use same one-liner to shift selector column as on drag handler (#895)
1 parent cb6238e commit 9d16ea8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Grid.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,8 @@ public function addSelection()
675675
{
676676
$this->selection = $this->table->addColumn(null, 'CheckBox');
677677

678-
// Move element to the beginning
679-
$k = array_search($this->selection, $this->table->columns);
680-
$this->table->columns = [$k => $this->table->columns[$k]] + $this->table->columns;
678+
// Move last column to the beginning in table column array.
679+
array_unshift($this->table->columns, array_pop($this->table->columns));
681680

682681
return $this->selection;
683682
}
@@ -691,6 +690,7 @@ public function addSelection()
691690
public function addDragHandler()
692691
{
693692
$handler = $this->table->addColumn(null, 'DragHandler');
693+
694694
// Move last column to the beginning in table column array.
695695
array_unshift($this->table->columns, array_pop($this->table->columns));
696696

0 commit comments

Comments
 (0)