Skip to content

Commit a697307

Browse files
committed
Merge pull request #169 from apizzini/fluent-bug-fix
Fluent bug fix
2 parents 30d8619 + e6fe066 commit a697307

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Bllim/Datatables/Datatables.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,13 @@ protected function saveQuery($query)
361361
$this->query = $query;
362362
$this->query_type = $query instanceof \Illuminate\Database\Query\Builder ? 'fluent' : 'eloquent';
363363
if ($this->dataFullSupport) {
364-
$this->columns = array_map(function ($column) {
365-
return trim(DB::connection()->getPdo()->quote($column['data']), "'");
366-
}, $this->input['columns']);
364+
if ($this->query_type == 'eloquent') {
365+
$this->columns = array_map(function ($column) {
366+
return trim(DB::connection()->getPdo()->quote($column['data']), "'");
367+
}, $this->input['columns']);
368+
} else {
369+
$this->columns = ($this->query->columns ?: array());
370+
}
367371
} else {
368372
$this->columns = $this->query_type == 'eloquent' ? ($this->query->getQuery()->columns ?: array()) : ($this->query->columns ?: array());
369373
}
@@ -760,7 +764,7 @@ protected function filtering()
760764

761765
// column search
762766
for ($i = 0, $c = count($this->input['columns']); $i < $c; $i++) {
763-
if (isset($column_aliases[$i]) && $this->input['columns'][$i]['orderable'] == "true" && $this->input['columns'][$i]['search']['value'] != '') {
767+
if (isset($column_aliases[$i]) && $this->input['columns'][$i]['searchable'] == "true" && $this->input['columns'][$i]['search']['value'] != '') {
764768
// if filter column exists for this columns then use user defined method
765769
if (isset($this->filter_columns[$column_aliases[$i]])) {
766770

0 commit comments

Comments
 (0)