Laravel-datatables: A non well formed numeric value encountered

Created on 11 Jun 2019  路  3Comments  路  Source: yajra/laravel-datatables

Summary of problem or feature request

Calling DataTables::of for collection is leading to error

"A non well formed numeric value encountered"

{"draw":1,"recordsTotal":21,"recordsFiltered":0,"data":[],"error":"Exception Message:\n\nA non well formed numeric value encountered"}

Code snippet of problem

public function getReport(Request $request)
    {
        $start = Carbon::parse($request->start)->format('Y-m-d ');
        $end = Carbon::parse($request->end)->format('Y-m-d');

        $cdrs = Cdr::whereBetween(DB::raw('date(start)'), [$start, $end])->get(['src', 'dst', 'start', 'answer', 'end', 'duration', 'disposition', 'recordingfile']);

        //dd($cdrs);
        return DataTables::of($cdrs)->toJson();
    }

  • Operating System Windows 10
  • PHP Version 7.2
  • Laravel Version 5.8
  • Laravel-Datatables Version 9.0
question

Most helpful comment

You should not use start on your variable name because DT uses this for pagination. Try changing the variable name.

$request->start --> $request->start_date

All 3 comments

Sorry to bother guys. I was doing a silly mistake! Calling get() to select columns.

Error is coming when I put serverSide: true

You should not use start on your variable name because DT uses this for pagination. Try changing the variable name.

$request->start --> $request->start_date
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmadbadpey picture ahmadbadpey  路  3Comments

SGarridoDev picture SGarridoDev  路  3Comments

josiahke picture josiahke  路  3Comments

macnux picture macnux  路  3Comments

shadoWalker89 picture shadoWalker89  路  3Comments