Advertisement
Guest User

item.php

a guest
Apr 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.95 KB | None | 0 0
  1. <?php
  2. $items = $functions->getItems();
  3. $projects = $functions->getProjects();
  4. $itemProjects = $functions->getItemNodes();
  5. ?>
  6.  
  7. <link rel="stylesheet" href="chosen_v1.8.5/chosen.css">
  8.  
  9. <div class="table-wrapper" id="table-top">
  10.     <img class="settings" src="img/settings.png" alt="Nustatymai">
  11.     <h2>Gaminys</h2>
  12.     <table id="gaminys">
  13.         <thead>
  14.             <tr>
  15.                 <th>Pavadinimas</th>
  16.                 <th>Projektas</th>
  17.                 <th>Grupė</th>
  18.                 <th>Aprašymas</th>
  19.                 <th class="veiksmai-sm">Veiksmai</th>
  20.             </tr>
  21.         </thead>
  22.         <tbody>
  23.         </tbody>
  24.     </table>
  25.     <div class="pagination-wrapper">
  26.         <ul class="pagination"></ul>
  27.     </div>
  28. </div>
  29.   <script src="chosen_v1.8.5/docsupport/jquery-3.2.1.min.js" type="text/javascript"></script>
  30.   <script src="chosen_v1.8.5/chosen.jquery.js" type="text/javascript"></script>
  31.   <script src="chosen_v1.8.5/docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
  32.   <script src="chosen_v1.8.5/docsupport/init.js" type="text/javascript" charset="utf-8"></script>
  33. <script>
  34. $(function () {
  35.     submit();
  36.     $('#search').on('change, input', function() {
  37.         submit();
  38.     });
  39.     $('.pagination').on('click', function(e) {
  40.         if ($(e.target).prop('tagName').toLowerCase() == 'li') {
  41.             submit($(e.target).attr('data-page'));
  42.             window.location = "#table-top";
  43.         }
  44.     });
  45. })
  46.  
  47. function submit(page = false) {
  48.     var get = getUrlVars();
  49.     $.ajax({
  50.         url: 'ajax_controller.php?page=getItemsData',
  51.         type: 'post',
  52.         data: $.param({ 'search': $('#search').val() })+'&'+$.param({ 'page': page }),
  53.         async: true,
  54.         success: function (result) {
  55.             var result = JSON.parse(result);
  56.             $('#gaminys tbody').html(result['result']);
  57.             $('.pagination').html(result['pages']);
  58.             $(".multiSelect").chosen({width: "100%"});
  59.         },
  60.     });
  61. }
  62.  
  63. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement