datatable limit correction
This commit is contained in:
+10
-9
@@ -240,14 +240,6 @@ final class Table {
|
|||||||
$i_order = $this->__cpa->Get("order", 0);
|
$i_order = $this->__cpa->Get("order", 0);
|
||||||
|
|
||||||
if ($id_draw > 0) {
|
if ($id_draw > 0) {
|
||||||
$t_order = "ASC";
|
|
||||||
if ($i_order <> 0) {
|
|
||||||
$t_order = ($i_order[0]['dir']=="asc") ? "ASC" : "DESC";
|
|
||||||
$i_order = $i_order[0]['column'];
|
|
||||||
}
|
|
||||||
$sql_limit = ($i_start>=0 && $i_length != -1) ? " LIMIT ".$i_start.", ".$i_length : "";
|
|
||||||
$sql_order = ($this->__afield[$i_order]) ? " ORDER BY ".$this->__afield[$i_order]." ".$t_order : "";
|
|
||||||
|
|
||||||
$record = 0;
|
$record = 0;
|
||||||
$this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__ttable.$this->__twhere);
|
$this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__ttable.$this->__twhere);
|
||||||
if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0));
|
if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0));
|
||||||
@@ -255,9 +247,18 @@ final class Table {
|
|||||||
$adata['recordsTotal'] = $record;
|
$adata['recordsTotal'] = $record;
|
||||||
$adata['recordsFiltered'] = $record;
|
$adata['recordsFiltered'] = $record;
|
||||||
|
|
||||||
|
$t_order = "ASC";
|
||||||
|
if ($i_order <> 0) {
|
||||||
|
$t_order = ($i_order[0]['dir']=="asc") ? "ASC" : "DESC";
|
||||||
|
$i_order = $i_order[0]['column'];
|
||||||
|
}
|
||||||
|
if ($i_length > $record) $i_length = -1;
|
||||||
|
$sql_limit = ($i_start>=0 && $i_length != -1) ? " LIMIT ".$i_start.", ".$i_length : "";
|
||||||
|
$sql_order = ($this->__afield[$i_order]) ? " ORDER BY ".$this->__afield[$i_order]." ".$t_order : "";
|
||||||
|
|
||||||
$adata['data'] = [];
|
$adata['data'] = [];
|
||||||
$this->__cdb->Query("SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit);
|
$this->__cdb->Query("SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit);
|
||||||
$adata['sql'] = "SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit;
|
//$adata['sql'] = "SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit;
|
||||||
while ($this->__cdb->Next()) {
|
while ($this->__cdb->Next()) {
|
||||||
$abaris = [];
|
$abaris = [];
|
||||||
$aoption = ['button'=>[]];
|
$aoption = ['button'=>[]];
|
||||||
|
|||||||
Reference in New Issue
Block a user