bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

Data added by add_column isn't searchable #217

Closed Soufraz closed 7 years ago

Soufraz commented 9 years ago

When I added data by add_column function, I cant search it. On the other hand, I know that inner join works for some cases. In this case, join is very slow to run.

Case:

    $receivables = Receivables::join('payments', 'receivables.id_payment', '=', 'payments.id')
    ->select(['receivables.id',
              'receivables.number',
              'payments.sale_cod',
              'receivables.total']);

    return Datatables::of($receivables)
        ->remove_column('id')
        ->add_column('client', '{{ HelperRS::getClientNameBySaleCod($sale_cod) }}', 4)
        ->make();