bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

JS issue with bllim/laravel4-datatables #187

Open jaiimg opened 9 years ago

jaiimg commented 9 years ago

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