I implemented custom search facility to my project using laravel Yajra datatable package. after implement this feature default regex search function not working. I cannot identify the issue. please help me to resolve this immedietly. my code is,
javascript code in blade file
function search(){
$("#cus_cat_price_list_details").show();
$('#cus_cat_price_table').DataTable({
processing: true,
serverSide: true,
destroy: true,
searching: true,
ajax: {
url: "",
data: function (d) {
d.cus_name = $('#cus_name').val();
d.pro_id = $('#pro_id').val();
}
},
columns: [
{ data: 'cus_cat', name: 'cus_cat' },
{ data: 'pro_no', name: 'pro_no' },
{ data: 'pro_name', name: 'pro_name' },
{ data: 'cash_price', name: 'cash_price', className: 'text-right' },
{ data: 'credit_price', name: 'credit_price', className: 'text-right' },
{ data: 'cus_cat_price_date', name: 'cus_cat_price_date' },
]
});
}
Controller
public function search(Request $request){
$cusCatPriceList = DB::table('customer_category_wise_price_list AS ccpl')
->join('product as p', 'p.pro_id','ccpl.pro_id')
->select([
DB::raw("'SR' AS cus_cat"),
'ccpl.pro_no',
'p.pro_name',
'ccpl.cash_price',
'ccpl.credit_price',
'ccpl.cus_cat_price_date',
])
->whereNull('ccpl.deleted_at')
->groupBy('ccpl.cus_cat_price_id');
return Datatables::of($cusCatPriceList)
->filter(function ($query) use ($request) {
if ($request->has('pro_id') && $request->get('pro_id') != "0") {
$query->where('ccpl.pro_id', '=', "{$request->get('pro_id')}");
}
})
->make(true);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire