Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3. $.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings)
  4. {
  5. return {
  6. "iStart": oSettings._iDisplayStart,
  7. "iEnd": oSettings.fnDisplayEnd(),
  8. "iLength": oSettings._iDisplayLength,
  9. "iTotal": oSettings.fnRecordsTotal(),
  10. "iFilteredTotal": oSettings.fnRecordsDisplay(),
  11. "iPage": Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength),
  12. "iTotalPages": Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)
  13. };
  14. };
  15.  
  16. var t = $("#mytable").dataTable({
  17. initComplete: function() {
  18. var api = this.api();
  19. $('#mytable_filter input')
  20. .off('.DT')
  21. .on('keyup.DT', function(e) {
  22. if (e.keyCode == 13) {
  23. api.search(this.value).draw();
  24. }
  25. });
  26. },
  27. oLanguage: {
  28. sProcessing: "loading..."
  29. },
  30. processing: true,
  31. serverSide: true,
  32. ajax: {"url": "json", "type": "POST"},
  33. columns: [
  34. {
  35. "data": "kduser_lamar",
  36. "orderable": false
  37. },{"data": "noktp"},{"data": "nama_lengkap"},{"data": "kategoriloker"},{"data": "loker"},{"data":"status"},
  38. {
  39. "data" : "action",
  40. "orderable": false,
  41. "className" : "text-center"
  42. }
  43. ],
  44. order: [[0, 'desc']],
  45. rowCallback: function(row, data, iDisplayIndex) {
  46. var info = this.fnPagingInfo();
  47. var page = info.iPage;
  48. var length = info.iLength;
  49. var index = page * length + (iDisplayIndex + 1);
  50. $('td:eq(0)', row).html(index);
  51. }
  52. });
  53. });
  54. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement