Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function()
- {
- //TABLE//
- oTable = $('#tabledata').dataTable({
- "sPaginationType": "full_numbers",
- "bServerSide": true,
- "sAjaxSource": "<?php echo base_url(); ?>/controller/datatables",
- "bAutoWidth": false,
- "aaSorting": [[1, 'asc']],
- "aoColumns": [
- { "sClass": "left", "sName": "codigo" },
- { "sClass": "center", "sName": "nome" }
- ],
- "fnServerData": function ( sSource, aoData, fnCallback ) {
- $.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- });
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
- var eventClass = '';
- if (aData[1] == 'andrey' )
- {
- eventClass = 'gradeX';
- }
- if(eventClass != '')
- $(nRow).addClass( eventClass );
- return nRow;
- }
- });
- });
- </script>
- <table class="datatable" id="tabledata">
- <thead>
- <tr>
- <th>Còdigo</th>
- <th>Nome</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment