IgnitedDatatables / Ignited-Datatables

Ignited Datatables is a wrapper class/library based on the native Datatables server-side implementation by Allan Jardine found at http://datatables.net/examples/data_sources/server_side.html for CodeIgniter
285 stars 337 forks source link

return thead #102

Open tiegosilveira opened 9 years ago

tiegosilveira commented 9 years ago

how can I do, besides the query returns the thead?

controller $this->datatables->set_database('cactiagenda');//banco $this->datatables->select('USU_ID,USU_NOME') ->from('usuario'); $data = json_decode($this->datatables->generate("json"), true);

view table id="post_table" border="1" cellpadding="2" cellspacing="1" class=" display compact table bordered"> /table>

js $( ".agenda" ).click(function() { semana = $(this).val(); var oTable = $('#post_table').dataTable({ "bProcessing": true, "bServerSide": true, "sAjaxSource": baseurl + "agendax/listingAgenda/"+semana, "aaSorting": [[1, "asc"]], "bPaginate": false,//desabilita a paginação // retrieve: true, // paging: false, "bDestroy": true, //aqui devera ir os theads "columnDefs": [ { "title": "Id", "targets": 0 }, { "title": "Funcioário", "targets": 1 }, { "title": "engine","targets": 0 }, // { "title": "Segunda", "targets": 3 }, // { "title": "Terça", "targets": 4 }, // { "title": "Quarta", "targets": 5 }, // { "title": "Quinta", "targets": 6 }, // { "title": "Sexta", "targets": 7 }, // { "title": "Sábado", "targets": 8 }, ], "columns": [//colunas {"name": "eventos.USU_ID", "data": "USU_ID"}, {"name": "eventos.USU_NOME", "data": "USU_NOME"}, {"name": "Domingo", "data": "Domingo"}, {"name": "Segunda", "data": "Segunda"}, {"name": "Terça", "data": "Terça"}, {"name": "Quarta", "data": "Quarta"}, {"name": "Quinta", "data": "Quinta"}, {"name": "Sexta", "data": "Sexta"}, {"name": "Sábado", "data": "Sábado"}, ], "bJQueryUI": true, "sPaginationType": "full_numbers", "iDisplayStart ": 20, 'fnServerData': function(sSource, aoData, fnCallback) { $.ajax ({ 'dataType': 'json', 'type': 'POST', 'url': sSource, 'data': aoData, 'success': fnCallback }); } }); $('#post_table_wrapper .dataTables_filter input').addClass("form-control input-sm input-medium"); $('#post_table_wrapper .dataTables_length select').addClass("form-control input-sm input-xsmall"); });