Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CollectionProvider]: Need Help #40

Open
mverma16 opened this issue May 19, 2016 · 4 comments
Open

[CollectionProvider]: Need Help #40

mverma16 opened this issue May 19, 2016 · 4 comments

Comments

@mverma16
Copy link

mverma16 commented May 19, 2016

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.

@timgws
Copy link
Member

timgws commented May 19, 2016

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;

@mverma16
Copy link
Author

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

@mverma16
Copy link
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.

@mverma16 mverma16 reopened this May 24, 2016
@timgws
Copy link
Member

timgws commented May 25, 2016

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants