hi, nice to meet you all, I'm working on a backend website project using codeigniter 3 and sbadmin2.

hi, nice to meet you all, I'm working on a backend website project using codeigniter 3 and sbadmin2.

NisaaaNisaaa Posts: 1Questions: 1Answers: 0
edited June 20 in Free community support

hi, nice to meet you all, I'm working on a backend website project using codeigniter 3 and sbadmin2. I use datatables to export files and print files, but when I create the feature for export and print it doesn't appear, after I try it on live.datatables.net the feature appears but in my project it doesn't appear. please help anyone. This is a project to fulfill my thesis.

https://live.datatables.net/wuniboho/1/

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Laporan Aset</title>

    <!-- Bootstrap CSS -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">

    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.2/css/buttons.dataTables.min.css">
</head>

<body>
    <div class="container mt-5">
        <h1 class="mb-4">Laporan Aset</h1>
        <div class="table-responsive">
            <table class="table table-bordered display nowrap" id="iniData" style="width:100%">
                <thead>
                    <tr>
                        <th>No</th>
                        <th>No Registrasi</th>
                        <th>Nama Aset</th>
                        <th>Nama Kategori</th>
                        <th>Merk</th>
                        <th>Ruang</th>
                        <th>Kondisi</th>
                        <th>Tanggal Perolehan</th>
                        <th>Nilai Perolehan</th>
                        <th>Pegawai</th>
                        <th>Supplier</th>
                        <th>Umur Ekonomis</th>
                        <th>Tanggal Maintenance</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $No = 1;
                    foreach ($aset as $row): ?>
                        <tr>
                            <td><?= $No++ ?></td>
                            <td><?= $row['No_reg'] ?></td>
                            <td><?= $row['Nama_aset'] ?></td>
                            <td><?= $row['Nama_kategori'] ?></td>
                            <td><?= $row['Merk_aset'] ?></td>
                            <td><?= $row['Nama_ruang'] ?></td>
                            <td><?= $row['Kondisi_aset'] ?></td>
                            <td><?= $row['Tanggal_perolehan'] ?></td>
                            <td><?= $row['Nilai_perolehan'] ?></td>
                            <td><?= $row['Nama_pegawai'] ?></td>
                            <td><?= $row['Nama_supplier'] ?></td>
                            <td><?= $row['Umur_ekonomis'] ?></td>
                            <td><?= $row['Tanggal_maintenance'] ?></td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>

    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Bootstrap JS -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
    <!-- DataTables Buttons JS -->
    <script src="https://cdn.datatables.net/buttons/2.2.2/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.print.min.js"></script>

    <!-- Custom Script to Initialize DataTables -->
    <script>
        $(document).ready(function () {
            $('#iniData').DataTable({
                dom: 'Bfrtip',
                buttons: [
                    'copyHtml5',
                    'excelHtml5',
                    'csvHtml5',
                    'pdfHtml5',
                    'print'
                ]
            });
        });

    </script>
</body>

</html>

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,234Questions: 1Answers: 2,597

    If it works on live, but not on your site, then it must be something to do with how the sources are being loaded, either they're being loaded twice or the timing is wrong. Check and see if anything else on the page is loading any of the files, or other versions of those files,

    Colin

Sign In or Register to comment.