Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

filterColumn wrong behavior? #108

Copy link
Copy link
@diorgesl

Description

@diorgesl
Issue body actions

Look this code

public function plex_cliente_datatables() {
        $clientes = PlexCliente::query();
        return DataTables::eloquent($clientes->with('servicos_alias'))
            ->addColumn('servicos_alias', function(PlexCliente $c) {
                $servicos = null;
                foreach($c->servicos_alias as $servico) {
                    $servicos .= $servico->id . ($servico->alias ? '(' . $servico->alias . ')' : ''). ', ';
                }
                return substr($servicos, 0, -2);
            })
            ->filterColumn('cpf_cnpj', function($query, $keyword) {
                $sql = "REPLACE(REPLACE(REPLACE(cpf_cnpj, '.', ''), '-', ''), '/', '')  LIKE ?";
                $keyword = preg_replace('/\D/', '', $keyword);
                $query->whereRaw($sql, ["%{$keyword}%"]);
            })
            ->toJson();
    }

When I use the filterColumn, the search works only for this column.

Can you help how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.