Skip to content

Commit a4c4546

Browse files
committed
refactor: ottimizzazione caricamento datatables
1 parent 8c8cfc7 commit a4c4546

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

ajax_dataload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
'draw' => $draw_numer,
6060
];
6161

62-
$query = Query::getQuery($structure);
62+
$query = Query::getQuery($structure, [], [], [], $total);
6363
if (!empty($query)) {
6464
// CONTEGGIO TOTALE
6565
$results['recordsTotal'] = $dbo->fetchNum($query);

src/Util/Query.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,11 @@ public static function replacePlaceholder($query)
183183
*
184184
* @return mixed|string
185185
*/
186-
public static function getQuery($structure, $search = [], $order = [], $limit = [])
186+
public static function getQuery($structure, $search = [], $order = [], $limit = [], $total = [])
187187
{
188-
$total = self::readQuery($structure);
188+
if (empty($total)) {
189+
$total = self::readQuery($structure);
190+
}
189191

190192
// Lettura parametri modulo
191193
$query = $total['query'];

0 commit comments

Comments
 (0)