Skip to content

Commit 5cffdb7

Browse files
committed
fix legacy code ordering
1 parent a901c8d commit 5cffdb7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/yajra/Datatables/Datatables.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -653,24 +653,23 @@ private function doPaging()
653653
private function doOrdering()
654654
{
655655
if (array_key_exists('order', $this->input) && count($this->input['order']) > 0) {
656-
$columns = $this->cleanColumns($this->last_columns);
657-
658656
for ($i = 0, $c = count($this->input['order']); $i < $c; $i++) {
659657
$order_col = (int) $this->input['order'][$i]['column'];
660658
$order_dir = $this->input['order'][$i]['dir'];
659+
661660
if ($this->new_version) {
662661
$column = $this->input['columns'][$order_col];
663662
if ($column['orderable'] == "true") {
664-
if ( ! empty($column['name'])) {
663+
if (! empty($column['name'])) {
665664
$this->query->orderBy($column['name'], $order_dir);
666665
} elseif (isset($columns[$order_col])) {
667666
$this->query->orderBy($columns[$order_col], $order_dir);
668667
}
669668
}
670669
} else {
671-
if (isset($columns[$order_col])) {
670+
if (isset($this->columns[$order_col])) {
672671
if ($this->input['columns'][$order_col]['orderable'] == "true") {
673-
$this->query->orderBy($columns[$order_col], $order_dir);
672+
$this->query->orderBy($this->columns[$order_col], $order_dir);
674673
}
675674
}
676675
}

0 commit comments

Comments
 (0)