laravel-datatables icon indicating copy to clipboard operation
laravel-datatables copied to clipboard

Global Filter Not Working : Column Null in function globalSearch with postgreSQL

Open adjisafandi opened this issue 3 years ago • 1 comments

hello bro, I'm adjis from Indonesia. I use yajra datatables for a long time, but I have several projects using postgreSQL databases. I found a problem when searching data globally. after I search, I found the problem that the globalSearch function can't capture the table column. finally I tried to modify the line code to run properly.

the following code I have made:

if($query->first()){
        $getColumns = array_keys($query->first()->getOriginal());
	foreach($getColumns as $col){
		if ($this->hasFilterColumn($col)) {
			$this->applyFilterColumn($query, $col, $keyword, 'or');
		} else {
			$this->compileQuerySearch($query, $col, $keyword);
		}
		$this->isFilterApplied = true;
	}
}

//OLD QUERY
if ($this->hasFilterColumn($column)) {
	$this->applyFilterColumn($query, $column, $keyword, 'or');
} else {
	$this->compileQuerySearch($query, $column, $keyword);
}
$this->isFilterApplied = true;

I made the code above to make the search run, but I don't know in the future there will be other problems after I make the code.

I hope there is an update that can solve the problem above.

thank you bro

  • Files : QueryDataTable.php, Line : 740
  • Version : ^9.19
  • My Laravel : ^9.0

adjisafandi avatar Apr 11 '22 02:04 adjisafandi

@adjisafandi can you send a pull request on the patch you did?

Also, can you provide a snippet on how to reproduce the issue? Thanks!

yajra avatar Jun 24 '22 01:06 yajra

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 10 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Oct 18 '22 00:10 github-actions[bot]