javascript - DataTable filtering (searching) add_column in Laravel project -


i have problem table rendered datatable bootstrap jquery in project (built in laravel 5).

the search (filtering) working columns generated sql query, columns generated add_column not working.

the javascript code 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 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 my_company_name', 'my_branches.name 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(); } 

update:

in situation understand can't search in column added ad_column. so, want implement function model, app\output_detail::getamountdue in select area. tried db:raw. it's not working, syntax correct, without result on webpage:

            $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 my_company_name', 'my_branches.name my_branch_name', 'outputs.output_at', 'outputs.invoice_id', 'outputs.customer_type'), db::raw(":amount amount_due",array('amount' =>  app\output_detail::getamountdue($id))))             ->where('outputs.invoice_status', $invoice_status)             ->where('outputs.is_deleted', false)             ->orderby('outputs.output_at', 'desc'); 


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -