0

i have error like this :

DataTables warning (table id = 'datatables'): Cannot reinitialise DataTable.

To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).

in my code when i want to display data from database in a same page (index) with diffrent query,,

this is my index code :

<!DOCTYPE html>
<html>
<head>
<title>Informasi Peralatan</title>
  <div id="container">
  <div id="text">
  <h1>Data informasi aset <br> Gedung BOP</h1>
  <h2>PT.PLN (PERSERO) SEKTOR PEMBANGKITAN TARAHAN</h2>
  <span class="admin">Selamat datang admin | Logout</span>
  </div>
  <div id="center">
  <link rel="stylesheet" href="../CSS/alat.css" type="text/css" media="screen" />
  <link href="../jquery-ui-1.8.16.custom/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
  <script src="../jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js"></script>
  <script src="../jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>


  <script>
  $(document).ready(function() {
    $("#tabs").tabs();
  });
  </script>
  </head>
<body style="font-size:62.5%;">
<div id="tabs">
    <ul>
        <li><a href="#fragment-1"><span>Alat (Lab Batu-bara)</span></a></li>
        <li><a href="#fragment-2"><span>Spare Part (Lab Batu bara)</span></a></li>
        <li><a href="#fragment-3"><span>Three</span></a></li>
    </ul>

    <div id="fragment-1">
        <p></p>
        <pre><code></code></pre>
      **<?php include "tampil_alat.php" ?> ** my first include 
    </div>
    <div id="fragment-2">
    ** <?php include "sparepart.php"; ?>  second included**
    </div>
    <div id="fragment-3">

    </div>
    <style type="text/css">
    #slider { margin: 10px; }
  </style>
  <script>
  $(document).ready(function() {
    $("#slider").slider();
  });
  </script>

</head>
<body style="font-size:62.5%;">
<div id="slider"></div>
<script>
  $(document).ready(function() {
    $("#dialog").dialog();
  });
  </script>
</head>
<body style="font-size:62.5%;">
<div id="footer"> 
<script>
    $(function(){
    $( "button,input:submit,a".".demo").button();
    $("a",".demo").click(function() {return false;});
    });
</script>
<div class="demo">
  <input type="submit" value="Tambah">
 <a href="#">tambah.php</a>

 <input type="submit" value="Edit">
 <a href="#"></a>

  <input type="submit" value="Hapus">
 <a href="#"></a>
 </div>
</div>
</div>
</div>
</div>
</body>
</html>

first include code :

<?php
include "koneksi.php";
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Datatables</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        
        <script src="media/js/jquery.js" type="text/javascript"></script>
        <script type="text/javascript"> var jY = $.noConflict(true); </script>
        <script src="media/js/jquery.dataTables.js" type="text/javascript"></script>
        <link rel="StyleSheet" href="media/css/demo_table_jui.css" type="text/css" />



        <style>
            *{
                font-family: arial;

            }
        </style>
        <script type="text/javascript" charset="utf-8">
            $(document).ready(function(){
                $('#datatables').dataTable({
                    "sPaginationType":"full_numbers",
                    "aaSorting":[[2, "desc"]],
                    "bJQueryUI":true

                });
            })

        </script>
    </head>
    <body>
        <div class="wrap">
            <div class="header">
            </div>
            <table id="datatables" class="display">
                <thead>
                    <tr>
                        <th>No</th>
                        <th>Nama Peralatan</th>
                        <th>No Part</th>
                        <th>Lokasi</th>
                        <th>Merk</th>
                        <th>Satuan</th>
                        <th>Jumlah</th>
                        <th>Fungsi</th>
                        <th>Keterangan</th>
                        <th>Gambar</th>
                        <th>Aksi</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if($_GET['action']  == 'delete'){  
                      mysql_query("delete from lab_batubara where id='".mysql_real_escape_string($_GET['idhapus'])."'");
                      echo("<script>alert('Data berhasil di hapus !');document.location.href='admin.php'</script>");
}                     
                  $result = mysql_query("SELECT * FROM lab_batubara where id=2"); code to display data
                    $no = 1;
                    while ($row = mysql_fetch_array($result)) {
                        ?>
                        <tr>
                            <td><?php echo $no; ?></td>
                            <td><?php echo $row['Nama_peralatan']?></td>
                            <td><?php echo $row['Part_No']?></td>
                            <td><?php echo $row['Lokasi']?></td>
                            <td><?php echo $row['Merk']?></td>
                            <td><?php echo $row['Satuan']?></td>
                            <td><?php echo $row['Jumlah']?></td>
                            <td><?php echo $row['Fungsi']?></td>
                            <td><?php echo $row['Keterangan']?></td>
                            <td><?php echo $row['Gambar']?></td>
                            <td><a class='delete' href='forminput_bop.php' onClick='DeleteData($(this))'>Tambah</a> |
                            <a class='edit' href='#' onClick='EditData($(this))'>Edit</a> |
                            <a href= "tampil_alat.php?idhapus=<?php echo $row['id'] ?>&action=delete" onClick="return confirm('Data akan di hapus dari database !')"> Delete</a>
                            </td>
                        </tr>
                        <?php
                        $no++;
                    }
                    ?>
                </tbody>
            </table>
        <div class="footer">
            <p align="center"> &copy; <?php echo date('Y'); ?></p>
        </div>
        </div>
    </body>
</html>

and this is my seconde inluded code

<?php
include "koneksi.php";
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Datatables</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        
        <script src="media/js/jquery.js" type="text/javascript"></script>
        <script type="text/javascript"> var jY = $.noConflict(true); </script>
        <script src="media/js/jquery.dataTables.js" type="text/javascript"></script>
        <link rel="StyleSheet" href="media/css/demo_table_jui.css" type="text/css" />



        <style>
            *{
                font-family: arial;

            }
        </style>

        <script type="text/javascript" charset="utf-8">
            $(document).ready(function(){
                $('#datatables').dataTable({
                    "sPaginationType":"full_numbers",
                    "aaSorting":[[2, "desc"]],
                    "bJQueryUI":true

                });
            })

        </script>
    </head>
    <body>
        <div class="wrap">
            <div class="header">
            </div>
            <table id="datatables" class="display">
                <thead>
                    <tr>
                        <th>No</th>
                        <th>Nama Peralatan</th>
                        <th>No Part</th>                        
                        <th>Merk</th>
                        <th>Lokasi</th>
                        <th>Satuan</th>
                        <th>Jumlah</th>
                        <th>Fungsi</th>
                        <th>Keterangan</th>
                        <th>Gambar</th>
                        <th>Aksi</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if($_GET['action']  == 'delete'){  
                      mysql_query("delete from lab_batubara where id='".mysql_real_escape_string($_GET['idhapus'])."'");
                      echo("<script>alert('Data berhasil di hapus !');document.location.href='admin.php'</script>");
}                   
                  $result = mysql_query("SELECT * FROM lab_batubara where id=1"); code to display data
                    $no = 1;
                    while ($row = mysql_fetch_array($result)) {
                        ?>
                        <tr>
                            <td><?php echo $no; ?></td>
                            <td><?php echo $row['Nama_peralatan']?></td>
                            <td><?php echo $row['Part_No']?></td>                            
                            <td><?php echo $row['Merk']?></td>
                            <td><?php echo $row['Lokasi']?></td>
                            <td><?php echo $row['Satuan']?></td>
                            <td><?php echo $row['Jumlah']?></td>
                            <td><?php echo $row['Fungsi']?></td>
                            <td><?php echo $row['Keterangan']?></td>
                            <td><?php echo $row['Gambar']?></td>
                            <td><a class='delete' href='forminput_bop.php' onClick='DeleteData($(this))'>Tambah</a> |
                            <a class='edit' href='#' onClick='EditData($(this))'>Edit</a> |
                            <a href= "tampil_alat.php?idhapus=<?php echo $row['id'] ?>&action=delete" onClick="return confirm('Data akan di hapus dari database !')"> Delete</a>
                            </td>
                        </tr>
                        <?php
                        $no++;
                    }
                    ?>
                </tbody>
            </table>
        <div class="footer">
            <p align="center"> &copy; <?php echo date('Y'); ?></p>
        </div>
        </div>
    </body>
</html>

thanks for any your help...

Edited by pritaeas: Moved

3
Contributors
4
Replies
11
Views
5 Years
Discussion Span
Last Post by Febby
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.