default sort error presupuestos datatable,set pagination to 50 and add page selector

This commit is contained in:
amazuecos
2024-10-25 11:27:27 +02:00
parent 2ac99d14c0
commit 716019bf81
2 changed files with 11 additions and 6 deletions

View File

@ -58,9 +58,9 @@ class ConfigErrores extends BaseResourceController
public function get_error_presupuesto(int $error_presupuesto_id)
{
$data = $this->errorPresupuestoModel->getErrorPresupuestoForm($error_presupuesto_id);
if(isset($data[0])){
if (isset($data[0])) {
return $this->response->setJSON(["data" => $data[0]]);
}else{
} else {
return $this->response->setJSON(["data" => []]);
}
}
@ -73,9 +73,9 @@ class ConfigErrores extends BaseResourceController
public function datatable()
{
$query = $this->errorPresupuestoModel->getQueryDatatable();
$query = $this->errorPresupuestoModel->getQueryDatatable()->orderBy("created_at", "DESC");
return DataTable::of($query)
->add("action", fn($q) => $q->id)
->toJson(true);
}
}
}

View File

@ -29,9 +29,14 @@ class ErrorPresupuestoView {
init() {
this.datatable = this.datatableItem.DataTable({
processing: true,
dom: 'Brtip',
layout :{
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
pageLength : 50,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},