Skip to content

Commit

Permalink
Fixed minor bugs and issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreydevreede committed Apr 14, 2015
1 parent 8b38f4e commit ef3588b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Eloquent DataTable plugin for server side ajax call handling.",
"keywords": [
"eloquent",
"laravel",
"datatable"
],
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/LiveControl/EloquentDataTable/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private function getRawColumnQuery($column)
return 'CONCAT(' . implode(', " ", ', $this->getRawColumns($column)) . ')';
}

return '`' . str_replace('.', '`.`', $column) . '`'; // user.firstname => `user`.`firstname`
return Model::resolveConnection()->getQueryGrammar()->wrap($column);
}

private function getDatabaseDriver()
Expand All @@ -202,7 +202,7 @@ private function addSelect()
$rawSelect = [];
foreach ($this->columns as $index => $column) {
if ( isset($this->rawColumns[$index]) ) {
$rawSelect[] = $this->rawColumns[$index] . ' AS `' . $this->columnNames[$index] . '`';
$rawSelect[] = $this->rawColumns[$index] . ' as ' . Model::resolveConnection()->getQueryGrammar()->wrap($this->columnNames[$index]);
}
}
$this->builder = $this->builder->select(new raw(implode(', ', $rawSelect)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ public function getSearchValue()

public function isColumnSearched($columnIndex)
{
return (isset($_POST['columns']) && isset($_POST['columns'][$columnIndex]) && isset($_POST['columns'][$columnIndex]['searchable']) && $_POST['columns'][$columnIndex]['searchable'] == 'true');
return (
isset($_POST['columns'])
&&
isset($_POST['columns'][$columnIndex])
&&
isset($_POST['columns'][$columnIndex]['search'])
&&
isset($_POST['columns'][$columnIndex]['search']['value'])
&&
$_POST['columns'][$columnIndex]['search']['value'] != ''
);
}

public function getColumnSearchValue($columnIndex)
Expand Down

0 comments on commit ef3588b

Please sign in to comment.