Postingan lainnya
Datatable tidak berfungsi
Saya mengalami kendala saat menggunakan datatable, dimana datatable tidak berfungsi sama sekali. Mungkin ada yang bisa membantu?
@extends('adminlte::page')
@section('content')
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Manajemen User</h3>
</div>
<div class="title_right">
</div>
</div>
</div>
@if (session('success'))
@alert(['type' => 'success'])
{!! session('success') !!}
@endalert
@endif
<!-- /.card-body -->
</div>
<!-- /.card -->
<div class="card">
<div class="card-header">
<a href="{{ route('user.create') }}"
class="btn btn-primary btn-sm">
<i class="fa fa-edit"></i> Tambah Akun
</a>
</div>
<!-- /.card-header -->
<div class="card-body">
<table id="datatable" class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Email</th>
<th>Created at</th>
<th>Last Update</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@php $no = $users->firstItem(); @endphp
@forelse ($users as $row)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $row->name }}</td>
<td>{{ $row->email }}</td>
<td>{{ $row->created_at }}</td>
<td>{{ $row->updated_at }}</td>
<td>
<form action=" {{ route ('user.destroy', $row->id) }} " method="POST">
@csrf
<input type="hidden" name="_method" value="DELETE">
<a href=" {{ route('user.edit', $row->id) }} " class="btn btn-warning btn-xs">
<i class="fa fa-edit"></i>
</a>
<button class="btn btn-danger btn-xs"><i class="fa fa-trash"></i>
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="text-center">Tidak ada data</td>
</tr>
@endforelse
</tbody>
</table>
<script>
$(document).ready(function() {
$('#datatable').DataTable();
});
</script>
</div>
</body>
@slot('footer')
@endslot
</div>
</div>
</div>
</section>
</div>
@endsection
Tanggapan
jquery sama datatabelya udah di include ?
Sudah include jquery dan datatabelnya. Bisa minta tolong masukannya? Kira" masalahnya dmn ya?
2 Jawaban:
Sudah include jquery dan datatabelnya. Bisa minta tolong masukannya? Kira" masalahnya dmn ya?
Bisa cek file .env apakah sudah terhubung dengan databasenya.
Sertakan gambar untuk masalahnya...
Tanggapan
Sudah database sudah terkoneksi masalahnya ada error datatablenya "uncaught referenceerror: $ is not defined" padahal asset jquery sdh terload semua.