Skip to content

Do you have a complete example available? #47

Description

@Josh5A

I can't get any of the examples as written to work. They all seem to be missing instructions. For example, simple initializing has a javascript section but what file does that code go into?

When I try this:

<?php

namespace App\Controllers;

use \Hermawan\DataTables\DataTable;

class Test extends BaseController
{
    public function index()
    {
        $db = $this->db;
        $builder = $db->table('mytable')->select('id, title');
        
        return DataTable::of($builder)->toJson();
        
    }
}

I get the following error:

{
    "error": "no datatable request detected"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions