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

JS issue with bllim/laravel4-datatables #187

Open
jaiimg opened this issue Jan 11, 2015 · 0 comments
Open

JS issue with bllim/laravel4-datatables #187

jaiimg opened this issue Jan 11, 2015 · 0 comments
Labels

Comments

@jaiimg
Copy link

jaiimg commented Jan 11, 2015

I am using bllim\laravel4-datatables-package using the tutorial in the below link, http://barnaszalai.eu/article/tips-and-tricks-using-datatables-with-laravel%23disqus_thread

I am able to get JSON output by accessing the URL directly.

When I access the View, It shows only --- The table header along with processing message When I click the "No. Page Entries(dropdown)", I gets error message Invalid JSON Response and then data's to the table is loaded

It doesn't loads the Data to the Table on First

Route

Route::get('admin/memberslist', array('as' => 'memberslist', 'uses' => OrdersController@memberslist'));

Method

public function memberslist()
    {
        $pages = Orders::select(array('id','name','email','updated_at'));
        return Datatables::of($pages)
            ->make();
    }

JS

$('#articles').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "admin/memberslist",
    "aaSorting": [[ 3, "desc" ]],
    "aoColumns": [
            { 'sWidth': '60px' },
            { 'sWidth': '130px', 'sClass': 'center' },
            { 'sWidth': '180px', 'sClass': 'center' },
            { 'sWidth': '60px', 'sClass': 'center' },
        ]
});

HTML

<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-condensed table-bordered" id="articles">
    <thead>
        <tr>
            <th>ID</th>
            <th>name</th>
            <th>Email</th>
            <th>Created At</th>
        </tr>
    </thead>
    <tbody>
        <tr>            
            <td></td>
            <td></td>
            <td></td>           
            <td></td>
        </tr>
    </tbody>
</table>

I have included the below css and js as well

jquery.js, jquery.dataTables.js, dataTables.bootstrap.css

using Xampp 5.6.3 on Windows 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants