hermawanramadhan / CodeIgniter4-DataTables

MIT License
92 stars 38 forks source link

Getting Error #29

Closed prajeesh-stratagile closed 1 year ago

prajeesh-stratagile commented 1 year ago

Describe the bug https://www.nicesnippets.com/blog/codeigniter-4-server-side-datatable-example-tutorial I was followed this tutorial in CodeIgniter 4.2.10, but getting the followed error.

Your code Please write the code that makes the bug appear (PHP and JS) `<?php namespace App\Controllers; use CodeIgniter\Controller; use Hermawan\DataTables\DataTable; use App\Models\UserModel;

class DatatableController extends Controller { public function __construct() { $db = db_connect(); $this->UserModel = new UserModel($db); }

/**
 * Write code on Method
 *
 * @return response()
 */
public function index()
{
    helper('url');
    return view('userView');
}

/**
 * Write code on Method
 *
 * @return response()
 */
public function ajaxDataTables()
{
    $model      = new UserModel();
    $data       = $model->where('Email', 'super@email.com')->first();

    return DataTable::of($data)
           ->addNumbering() //it will return data output with numbering on first column
           ->toJson();
}

} ?>`

Screenshots If applicable, add screenshots to help explain your problem. image

Version (please complete the following information):

hermawanramadhan commented 1 year ago

hmm sorry late not maintenance this..

you just wrong how to use

$model      = new UserModel();
$data        = $model->where('Email', 'super@email.com');

you only need write like this without first() or findAll()