Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <!--Modal tabel Part Monthly Plan-->
- <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog" style="width:70%">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h4 class="modal-title" id="myModalLabel">Cari Part</h4>
- </div>
- <div class="modal-body">
- <table id="lookup" class="table table-bordered table-hover table-striped">
- <thead>
- <tr>
- <th>PartID</th>
- <th>Other ID</th>
- <th>PartName</th>
- </tr>
- </thead>
- <tbody>
- <?php
- //Data mentah yang ditampilkan ke tabel
- include '../config/db.php';
- $sql = "SELECT DISTINCT a.PartID, a.PartName,a.OtherID FROM ms_partcategory a ";
- $s = mysqli_query($conn, $sql);
- while ($data = mysqli_fetch_assoc($s)) {
- ?>
- <tr class="pilih" data-partid="<?php echo $data['PartID']; ?>">
- <td><?php echo $data['PartID']; ?></td>
- <td><?php echo $data['OtherID']; ?></td>
- <td><?php echo $data['PartName']; ?></td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $(document).on('click', '.pilih', function (e) {
- document.getElementById('typepartid_' + row).value = $(this).attr('data-partid');
- $('#myModal').modal('hide');
- });
- $(function () {
- $("#lookup").dataTable();
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement