0
I’m using serverside in the datatable Jquery. PHP plus Jquery. The data is pulled from the database. I specified that 9 records appear on each page (of the pagination). But I need that when I start looking for something I want the pagination to cease to exist and list 'all' the records. And when you stop searching, go back to normal with only 9 records per page and page. I know that the datatable is flexible and has the API commands to change that, the problem and that I do not know what is.
Some help?
example:
<script>
table = $(#table).datatable({
"processing": true,
"serverSide": true,
"order": [],
"ajax": {
"url": "<?php echo site_url('Locacao/ajax_list')?>",
"type": "POST",
},
"pageLength": "9",
"bPaginate": true
})
</script>
php metodh:
class Locacao extends CI_Controller {
public function __construct(){
$parente = parent::__construct();
$this->load->model('Locacao_model','locacao');
}
public function ajax_list()
{
$list = $this->locacao->get_datatables();
$data = array();
$no = $_POST['start'];
foreach ($list as $locacao) {
$no++;
$row = array();
$row[] = $locacao->id;
$row[] = $locacao->name;
$row[] = $locacao->date;
$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->locacao->count_all(),
"recordsFiltered" => $this->locacao->count_filtered(),
"data" => $data,
);
echo json_encode($output);
}
}
tried this way but unsuccessfully so far:
– Luciano
var oSettings = $table.fnSettings(); oSettings.bPaginate = false; $table.draw();
– Luciano
$table.on('search.dt', Function() { var value = $('. dataTables_filter input'). val(); Alert(value); });
– Luciano