0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Laravel×AdminLTEでDataTableを使用する

Last updated at Posted at 2022-09-28

こちらも軽くハマってしまったのでメモ。

以下を設定したところ、、

sample.blade.php
@section('js')
<script>
    $(function() {
        $('#example').DataTable();
    });
</script>
@endsection

このエラーが出ました。
image.png

DataTableが使えない?と思っていたところ、以下の設定だけでした。

config/adminlte.php
    'plugins' => [
        'Datatables' => [
            'active' => true, // ← これをfalse→trueにするだけ
            'files' => [

この辺を日本語化するには、
image.png

このようにします。

sample.blade.php
@section('js')
<script>
    $(function() {
        $('#example').DataTable(.DataTable({
            language: {
                url: "//cdn.datatables.net/plug-ins/be7019ee387/i18n/Japanese.json"
            }
        });
    });
</script>
@endsection
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?