DataTable filtering (searching) add_column in Laravel project

DataTable filtering (searching) add_column in Laravel project

emmemm Posts: 1Questions: 1Answers: 0
edited August 2015 in Free community support

I have a problem with a table rendered with DataTable Bootstrap Jquery in my project (built in Laravel 5).

The search (filtering) is working for the columns generated from SQL query, but for the columns generated with add_column is not working.

The javascript code from php file:

var oTable;
$(document).ready(function() {

    oTable = $('#table').dataTable({
        "sDom" : "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
        "sPaginationType" : "bootstrap",
        "bProcessing" : true,
        "bServerSide" : true,
        "sAjaxSource" : "{{ URL::to('employee/outputs/data/'.$invoice_status) }}",
        "fnDrawCallback" : function(oSettings) {
            $(".iframe").colorbox({
                iframe : true,
                width : "60%",
                height : "60%",
                onClosed : function() {
                    window.location.reload();
                }
            });
        }
    });
});

The code from Laravel Controller:

public function data($invoice_status)
{
    $outputs = Output::join('my_companies', 'my_companies.id', '=', 'outputs.my_company_id')
                     ->join('my_branches', 'my_branches.id', '=', 'outputs.my_branch_id')
                     ->select(array('outputs.id', 'my_companies.name as my_company_name', 'my_branches.name as my_branch_name', 'outputs.output_at', 'outputs.invoice_id', 'outputs.customer_type'))
                     ->where('outputs.invoice_status', $invoice_status)
                     ->where('outputs.is_deleted', false)
                     ->orderBy('outputs.output_at', 'DESC');

    return Datatables::of($outputs)
                    ->add_column('customer_name', '{{ App\Output::getCustomerName(App\Output::find($id)->customer_type,App\Output::find($id)->customer_id) }}')
                    ->add_column('auto', '{{ App\Output::find($id)->vehicle_number }}')
                    ->add_column('observations', '{{ App\Output::find($id)->observations }}')
                    ->make();
}
This discussion has been closed.