Advertisement
Guest User

Untitled

a guest
Jul 4th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.45 KB | None | 0 0
  1. <html>
  2. <body>
  3. <!--Modal tabel Part Monthly Plan-->
  4. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  5.            <div class="modal-dialog" style="width:70%">
  6.                 <div class="modal-content">
  7.                     <div class="modal-header">
  8.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  9.                         <h4 class="modal-title" id="myModalLabel">Cari Part</h4>
  10.                     </div>
  11.                     <div class="modal-body">
  12.                         <table id="lookup" class="table table-bordered table-hover table-striped">
  13.                             <thead>
  14.                                 <tr>
  15.                                     <th>PartID</th>
  16.                                     <th>Other ID</th>
  17.                                     <th>PartName</th>
  18.                                 </tr>
  19.                             </thead>
  20.                             <tbody>
  21.                                  <?php
  22.                                //Data mentah yang ditampilkan ke tabel    
  23.                                include '../config/db.php';
  24.                                
  25.                                $sql = "SELECT DISTINCT a.PartID, a.PartName,a.OtherID FROM ms_partcategory a ";
  26.                                
  27.                                 $s      = mysqli_query($conn, $sql);
  28.                                while ($data = mysqli_fetch_assoc($s)) {
  29.                                    ?>
  30.                                     <tr class="pilih" data-partid="<?php echo $data['PartID']; ?>">
  31.                                         <td><?php echo $data['PartID']; ?></td>
  32.                                         <td><?php echo $data['OtherID']; ?></td>
  33.                                         <td><?php echo $data['PartName']; ?></td>
  34.                                        
  35.                                     </tr>
  36.                                     <?php
  37.                                }
  38.                                ?>
  39.                             </tbody>
  40.                         </table>  
  41.                     </div>
  42.                 </div>
  43.             </div>
  44. </div>
  45. <script type="text/javascript">  
  46. $(document).on('click', '.pilih', function (e) {
  47.     document.getElementById('typepartid_' + row).value = $(this).attr('data-partid');
  48.     $('#myModal').modal('hide');
  49. });
  50.  
  51. $(function () {
  52.     $("#lookup").dataTable();
  53. });
  54. </script>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement