can I ask some help why it is not working.is there some files that are missing ?
Thank you in advance.
$(function() {
$('#mytable').DataTable({
processing: true,
serverSide: true,
ajax: '/admin/enrollment/all_list'
});
});
//routes.php
Route::get('admin/enrollment/all_list', 'Admin\EnrollmentController@getEnroll');
//EnrollmentController
public function getEnroll(){
$users = User::select(['studentid','fname','lname']);
return Datatables::of($users)->make();
}
Can you paste your table markup? It should look something like below. TH should match the selected columns. And also make sure you have at least v1.10.x of datatables.
<table id="mytable">
<thead>
<tr>
<th>Id</th>
<th>FName</th>
<th>LName</th>
</tr>
</thead>
</table>
@yajra ,
here it is
<table class="table table-striped table-bordered table-hover" width="100%" id="mytable">
<thead>
<tr>
<th></th>
<th>ID</th>
<th>FIRSTNAME</th>
<th>LASTNAME</th>
</tr>
</thead>
</table>
You have extra <th></th> which may have cause the issue.
@yajra ,
Thank you so much it works now
@yajra ,
why is it i have different loading icon in your demo ?
My demo have a customized css and loading image. You can copy it if you like.
which file to copy the loading image ?
/public/css/datatables.bootstrap.css and /public/images/loading_bar.gif or try adding this on your css.
.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 80px;
margin-left: -125px;
margin-top: -15px;
padding: 15px 0 30px 0;
border: 1px solid #ddd;
text-align: center;
color: #444;
font-size: 14px;
background: url("../images/loading_bar.gif") no-repeat center 38px #fff;
box-shadow: 2px 2px 5px #444;
-moz-box-shadow: 2px 2px 5px #444;
-webkit-box-shadow: 2px 2px 5px #444;
z-index: 9999;
}
@yajra ,
Thank you so much.
You're welcome!
my project is used laravel 5.2 and yajra version 6, some i search data error : DataTables warning: table id=datapegawai - Ajax error. For more information about this error, please see http://datatables.net/tn/7
in error on browser chrome, RuntimeException in EncryptionServiceProvider.php line 45:
No supported encrypter found. The cipher and / or key length are invalid.
i have tried to:

but still, sometimes keep error 7 tn, can i get the solution?
@faazlila maybe try clearing the cache and config.
php artisan cache:clear
php artisan config:clear
can I ask some help why it is not working.is there some files that are missing ?
Thank you in advance.
$(function(){
table = $('.table').DataTable({
"processing" : true,
"serverside" : true,
"ajax" : {
"url" : "{{ route('produk.data') }}",
"type" : "GET"
},
'columnDefs': [{
'targets': 0,
'searchable': false,
'orderable': false
}],
'order': [1, 'asc']
});
//ProdukController
public function listData()
{
$produk = Produk::leftJoin('kategori', 'kategori.id_kategori', '=', 'produk.id_kategori')
->orderBy('produk.id_produk', 'desc')
->get();
$no = 0;
$data = array();
foreach($produk as $list){
$no ++;
$row = array();
$row[] = "";
$row[] = $list->kode_produk;
$row[] = $list->nama_produk;
$row[] = $list->nama_kategori;
$row[] = "Rp. ".format_uang($list->harga_beli);
$row[] = "Rp. ".format_uang($list->harga_jual);
$data[] = $row;
}
return Datatables::of($data)->escapeColumns([])->make(true);
}
i got the same issue, solve by just changing the ajax type from 'get' into 'post', and change corresponding router in laravel from get to post, and
ajax: {
url: this.urls.get,
type: 'post',
Hi im gatting the same error which is discussed above. Can some one help?
DataTables warning: table id=itemListTable - Ajax error. For more information about this error, please see http://datatables.net/tn/7
Mark up::
| Name | FoodType | Price | Qty Available |
|---|---|---|---|
| Name | FoodType | Price | Qty Available |
Code:
$table.DataTable({
lengthMenu: [[3,5,10,-1],['3 Records','5 Records','10 Records','ALL']],
pageLength: 5,
ajax: {
url: jsonUrl,
dataSrc: ''
},
columns: [
{
data: 'name'
},
{
data: 'foodType'
},
{
data: 'unitPrice'
},
{
data: 'quantity'
},
]
});
@faazlila maybe try clearing the cache and config.
php artisan cache:clear php artisan config:clear
Thank you, cache and config clear solved my problem.
i am also getting same error
`
$(document).ready(function() {
var table = $('#table').DataTable({
lengthChange: false,
responsive: true,
serverSide: true,
ajax: '{{ route('playlist.show',$channel->id) }}',
columns: [
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'visibility',name:'visibility'},
{data : 'updatedat', name : 'updatedat',searchable : false},
{data : 'count', name : 'count',searchable : false},
],
});
});
</script>`
Most helpful comment
@faazlila maybe try clearing the cache and config.