CakePHP Pagination + DataTable issue
CakePHP Pagination + DataTable issue
Hi everyone,
I am a very newbie in DataTable and Ajax request with CakePHP but there is my issue:
I am trying to use DataTable with CakePHP 2.x.
So far I managed to retrieve data using the sAjaxSource parameter.
Although I paginated the request in my Controller, I can' see any pagination on my view.
My Controller side:
[code]
public function index() {
$permanences = $this->paginate();
$this->set(compact('permanences'));
$this->set('_serialize', array('permanences'));
}
[/code]
In my view side:
[code]
$('#permanencesDataTable').dataTable({
"oLanguage": {
"sLengthMenu": "Afficher _MENU_ résultats par page",
"sZeroRecords": "Aucun résultat - désolé",
"sInfo": "Résultat _START_ à _END_ sur _TOTAL_ enregistrements",
"sInfoEmpty": "Résultat 0 de 0 sur 0 enregistrement",
"sInfoFiltered": "(filtré de _MAX_ enregistrements)",
"sSearch": "Recherche",
"oPaginate": {
"sFirst": "<<", "sPrevious": "<", "sNext": ">", "sLast": ">>"
}
},
"bLengthChange": false,
"sDom": '<"top"flpi>rt<"bottom"><"clear">',
"sPaginationType": "full_numbers",
"iDisplayLength": 20,
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": src="<?php echo $this->base; ?>/permanences/index"})
[/code]
Any help will be very appreciated :)
Thanks!
I am a very newbie in DataTable and Ajax request with CakePHP but there is my issue:
I am trying to use DataTable with CakePHP 2.x.
So far I managed to retrieve data using the sAjaxSource parameter.
Although I paginated the request in my Controller, I can' see any pagination on my view.
My Controller side:
[code]
public function index() {
$permanences = $this->paginate();
$this->set(compact('permanences'));
$this->set('_serialize', array('permanences'));
}
[/code]
In my view side:
[code]
$('#permanencesDataTable').dataTable({
"oLanguage": {
"sLengthMenu": "Afficher _MENU_ résultats par page",
"sZeroRecords": "Aucun résultat - désolé",
"sInfo": "Résultat _START_ à _END_ sur _TOTAL_ enregistrements",
"sInfoEmpty": "Résultat 0 de 0 sur 0 enregistrement",
"sInfoFiltered": "(filtré de _MAX_ enregistrements)",
"sSearch": "Recherche",
"oPaginate": {
"sFirst": "<<", "sPrevious": "<", "sNext": ">", "sLast": ">>"
}
},
"bLengthChange": false,
"sDom": '<"top"flpi>rt<"bottom"><"clear">',
"sPaginationType": "full_numbers",
"iDisplayLength": 20,
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": src="<?php echo $this->base; ?>/permanences/index"})
[/code]
Any help will be very appreciated :)
Thanks!
This discussion has been closed.