Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var columns = [
  2.             {name: 'graphics', data: 'graphics', className: 'body-graph', searchable: false, orderable: false},
  3.             {name: 'idErp', data: 'idErp', orderable: false},
  4.             {name: 'name', data: 'name'},
  5.             {name: 'user', data: 'user', orderable: false},
  6.             {name: 'abc', data: 'abc'},
  7.             {name: 'city', data: 'city', orderable: false},
  8.             {name: 'uf', data: 'uf', orderable: false},
  9.             {name: 'industry', data: 'industry', orderable: false},
  10.             {name: 'segment', data: 'segment', orderable: false},
  11.             {name: 'ticket', data: 'ticket', orderable: false,
  12.                 createdCell: function (td) {
  13.                     $(td).css('text-align', 'right');
  14.                 }
  15.             },
  16.             {name: 'ticketMonth', data: 'ticketMonth', orderable: false,
  17.                 createdCell: function (td) {
  18.                     $(td).css('text-align', 'right');
  19.                 }
  20.             },
  21.             {name: 'evolution', data: 'evolution',
  22.                 createdCell: function (td, cellData) {
  23.                     var evolution = cellData.match(/\-?[0-9]+/g)[0];
  24.                     if (evolution > 0) {
  25.                         $(td).addClass('text-success');
  26.                     } else if (evolution < 0) {
  27.                         $(td).addClass('text-danger');
  28.                     }
  29.                 }
  30.             },
  31.             {name: 'calls', data: 'calls', searchable: false, orderable: false},
  32.             {name: 'lastProductiveCall', data: 'lastProductiveCall', orderable: false},
  33.             {name: 'nextCall', data: 'nextCall', orderable: false},
  34.         ];
  35.  
  36.         columns.push({name: 'freqTotal', data: 'freqTotal', searchable: false, orderable: false,
  37.             createdCell: function (td) {
  38.                 $(td).css('text-align', 'center');
  39.             }
  40.         });
  41.         columns.push({name: 'freqCurrent', data: 'freqCurrent', searchable: false, orderable: false,
  42.             createdCell: function (td) {
  43.                 $(td).css('text-align', 'center');
  44.             }
  45.         });
  46.         for (var i = 1; i <= 12; i++) {
  47.             columns.push({name: 'freqCurrent' + i, data: 'freqCurrent' + i, searchable: false, orderable: false,
  48.                 createdCell: function (td) {
  49.                     $(td).css('text-align', 'center');
  50.                 }
  51.             });
  52.         }
  53.         columns.push({name: 'freqPast', data: 'freqPast', searchable: false, orderable: false,
  54.             createdCell: function (td) {
  55.                 $(td).css('text-align', 'center');
  56.             }
  57.         });
  58.         for (var i = 1; i <= 12; i++) {
  59.             columns.push({name: 'freqPast' + i, data: 'freqPast' + i, searchable: false, orderable: false,
  60.                 createdCell: function (td) {
  61.                     $(td).css('text-align', 'center');
  62.                 }
  63.             });
  64.         }
  65.  
  66.         columns.push({name: 'valTotal', data: 'valTotal', searchable: false, orderable: false,
  67.             createdCell: function (td) {
  68.                 $(td).css('text-align', 'right');
  69.             }
  70.         });
  71.         columns.push({name: 'valCurrent', data: 'valCurrent', searchable: false, orderable: false,
  72.             createdCell: function (td) {
  73.                 $(td).css('text-align', 'right');
  74.             }
  75.         });
  76.         for (var i = 1; i <= 12; i++) {
  77.             columns.push({name: 'valCurrent' + i, data: 'valCurrent' + i, searchable: false, orderable: false,
  78.                 createdCell: function (td) {
  79.                     $(td).css('text-align', 'right');
  80.                 }
  81.             });
  82.         }
  83.         columns.push({name: 'valPast', data: 'valPast', searchable: false, orderable: false,
  84.             createdCell: function (td) {
  85.                 $(td).css('text-align', 'right');
  86.             }
  87.         });
  88.         for (var i = 1; i <= 12; i++) {
  89.             columns.push({name: 'valPast' + i, data: 'valPast' + i, searchable: false, orderable: false,
  90.                 createdCell: function (td) {
  91.                     $(td).css('text-align', 'right');
  92.                 }
  93.             });
  94.         }
  95.  
  96.         var dataTable = $('#table-abc')
  97.             .on('processing.dt', function (e, settings, processing) {
  98.                 $(this).css('display', processing ? 'none' : 'table');
  99.                 if (!processing) {
  100.                     $('[data-toggle="tooltip"]').tooltipster();
  101.                 }
  102.             })
  103.             .DataTable({
  104.                 oLanguage: {
  105.                     sEmptyTable: 'Nenhum registro encontrado',
  106.                     sInfo: 'Mostrando de _START_ até _END_ de _TOTAL_ registros',
  107.                     sInfoEmpty: 'Mostrando 0 até 0 de 0 registros',
  108.                     sInfoFiltered: '(Filtrados de _MAX_ registros)',
  109.                     sInfoPostFix: '',
  110.                     sInfoThousands: '.',
  111.                     sLengthMenu: '_MENU_ resultados por página',
  112.                     sLoadingRecords: 'Carregando',
  113.                     sProcessing: 'Carregando',
  114.                     sZeroRecords: 'Nenhum registro encontrado',
  115.                     sSearch: 'Pesquisar',
  116.                     oPaginate: {
  117.                         sNext: 'Próximo',
  118.                         sPrevious: 'Anterior',
  119.                         sFirst: 'Primeiro',
  120.                         sLast: 'Último'
  121.                     },
  122.                     oAria: {
  123.                         sSortAscending: ': Ordenar colunas de forma ascendente',
  124.                         sSortDescending: ': Ordenar colunas de forma descendente'
  125.                     }
  126.                 },
  127.                 autoWidth: false,
  128.                 scrollY: 500,
  129.                 scrollX: true,
  130.                 scrollCollapse: true,
  131.                 fixedColumns:   {
  132.                     leftColumns: 2,
  133.                 },
  134.                 searching: true,
  135.                 ordering: true,
  136.                 order: [4, 'asc'],
  137.                 paging: true,
  138.                 pageLength: 20,
  139.                 lengthChange: false,
  140.                 processing: true,
  141.                 serverSide: true,
  142.                 ajax: {
  143.                     url: 'index.php?componente=Abc&acao=DataTableAtendente',
  144.                     type: 'POST',
  145.                     data: {
  146.                         year: <?php echo $year; ?>,
  147.                         userId: '<?php echo $selectedUser['id']; ?>',
  148.                     },
  149.                 },
  150.                 columns: columns,
  151.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement