Welcome Guest, Not a member yet? Register   Sign In
Datatables and ORM Model

I'm building a new ORM Model, which uses sqlsrv driver and works

PHP Code:
namespace App\Models;
MyModel extends Model
$DBGroup 'sqlserver';
$table 'project';
$primaryKey 'idproject';
$useAutoIncrement true;
$returnType     'array';
$useSoftDeletes true;
$allowedFields = ['name''logo'];
$useTimestamps false;

I load that model from a Library and return data to Controller

$data = json_encode($this->mymodel->findAll());

Now, I must use Datatables in the view, with serverSide=true and Ajax property pointing to Controller's url

The json format for Datatables is custom and must have additional fields (draw, recordsTotal, data, etc.)

    "draw": 1,
    "recordsTotal": 57,
    "recordsFiltered": 57,
    "data": [
            "bla bla",

PS: I've already seen https://github.com/hermawanramadhan/Code...DataTables but it won't fit my needs in future

Does anyone have an example about how to build that custom json using the methods from ORM ?

Thanks a lot for any tip you can give me

Messages In This Thread
Datatables and ORM Model - by kabeza - 04-07-2022, 08:49 AM
RE: Datatables and ORM Model - by JustJohnQ - 04-07-2022, 11:38 PM
RE: Datatables and ORM Model - by kabeza - 04-08-2022, 04:41 AM

Theme © iAndrew 2016 - Forum software by © MyBB