Skip to content

[CollectionProvider]: Need Help #40

Open

Description

@kreatorcodes

I used chumper/datatable in my project but after upgrading my Laravel version to 5.2 I started facing issues in sorting in collection. So now I am trying to use Openskill Datatable in laravel 5.2. I tried to implement basic datatable by following the exact steps described in documentation.
I am getting an error saying that Class CollectionProvider not found.
capture

My controller function looks like
1

And in my view
2

I am not sure, am I doing something wrong?
Please help me out.

Activity

  1. timgws commented on May 19, 2016

    @timgws
    Member

    You do not have the correct use statements, to import the classes into your namespace.

    Add this:

    use OpenSkill\Datatable\DatatableService;
    use OpenSkill\Datatable\Providers\CollectionProvider;
    
  2. kreatorcodes commented on May 19, 2016

    @kreatorcodes
    Author

    @timgws Thank you, I knew I was doing something stupid as hell.

  3. kreatorcodes commented on May 24, 2016

    @kreatorcodes
    Author

    Hey Looks like some thing is still wrong in my project code. I am getting an ajax error. by looking request on my localhost -

    http://localhost/?draw=1&columns%5B0%5D%5Bdata%5D=name&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns.....' and gives the response
    as
    1

    I guess request is being send to wrong URL it should be like

    http://localhost/myproject[/public]?draw=1&columns%5B0%5D%5Bdata%5D=name&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns.....'

    Please tell me, what am I doing wrong?
    @Chumper I started facing issues in Chumper/Datatable after upgrading Laravel version of my project to 5.2. Sorting creates a problem and returns response which is not being rendered in datatable. Is this an issue with datatable itself? Can you help me to solve it because I'd like to stick to chumper datatable till the complete documentation for openskill is not available.

  4. timgws commented on May 25, 2016

    @timgws
    Member

    @mverma16 it looks like you are not setting the endpoint for the route that will handle the datatable request. (#20)

    Build your datatable like this:

    {{
        $datatable
            ->headers() // tell the table to render the header in the table
            ->columns('id', '#') // show # in the header instead of 'id'
            ->columns('name', 'Full name') // show 'Full name' in the header instead of 'name'
            ->endpoint(route('asd.asd'))
            // render just the table
            ->table()
    }}

    You should replace route('asd.asd') with either the name of the route, or with the URL that will handle the request.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions