Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return thead #102

Open
tiegosilveira opened this issue Aug 13, 2015 · 0 comments
Open

return thead #102

tiegosilveira opened this issue Aug 13, 2015 · 0 comments

Comments

@tiegosilveira
Copy link

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");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant