Guest User

Untitled

a guest
Mar 21st, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.41 KB | None | 0 0
  1. <script>
  2. $(document).ready(function()
  3. {
  4.     //TABLE//
  5.     oTable = $('#tabledata').dataTable({
  6.             "sPaginationType": "full_numbers",
  7.             "bServerSide": true,
  8.             "sAjaxSource": "<?php echo base_url(); ?>/controller/datatables",
  9.             "bAutoWidth": false,
  10.             "aaSorting": [[1, 'asc']],
  11.             "aoColumns": [
  12.                             { "sClass": "left", "sName": "codigo" },
  13.                             { "sClass": "center", "sName": "nome" }
  14.                           ],
  15.             "fnServerData": function ( sSource, aoData, fnCallback ) {              
  16.                 $.ajax( {
  17.                         "dataType": 'json',
  18.                         "type": "POST",
  19.                         "url": sSource,
  20.                         "data": aoData,
  21.                         "success": fnCallback
  22.                 });
  23.             },
  24.            "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
  25.                 var eventClass = '';
  26.                 if (aData[1] == 'andrey' )
  27.                 {
  28.                     eventClass = 'gradeX';
  29.                 }
  30.                 if(eventClass != '')
  31.                     $(nRow).addClass( eventClass );
  32.                 return nRow;
  33.             }
  34.         });
  35. });
  36. </script>
  37.  
  38. <table class="datatable" id="tabledata">
  39.     <thead>
  40.         <tr>
  41.             <th>Còdigo</th>
  42.             <th>Nome</th>
  43.         </tr>
  44.     </thead>
  45.     <tbody>
  46.     </tbody>
  47. </table>
Advertisement
Add Comment
Please, Sign In to add comment