fix: pagination count table

This commit is contained in:
Baoshuo Ren 2022-09-20 17:19:11 +08:00
parent 7b4fb77260
commit 6926a6f912
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 8 additions and 3 deletions

View File

@ -78,7 +78,8 @@ EOD;
$new_group_form->printHTML(); $new_group_form->printHTML();
} }
}, },
'head_pagination' => true 'head_pagination' => true,
'pagination_table' => "`groups`"
) )
); );
?> ?>

View File

@ -99,7 +99,8 @@ EOD;
'print_after_table' => function() { 'print_after_table' => function() {
global $myUser; global $myUser;
}, },
'head_pagination' => true 'head_pagination' => true,
'pagination_table' => 'lists'
) )
); );
?> ?>

View File

@ -16,7 +16,10 @@ class Paginator {
$this->cur_start = 0; $this->cur_start = 0;
$this->table = $config['data']; $this->table = $config['data'];
} elseif (!isset($config['echo_full'])) { } elseif (!isset($config['echo_full'])) {
$this->n_rows = DB::selectCount("select count(*) from {$config['table_name']} where {$config['cond']}"); if (!isset($config['pagination_table'])) {
$config['pagination_table'] = $config['table'];
}
$this->n_rows = DB::selectCount("select count(*) from {$config['pagination_table']} where {$config['cond']}");
$this->page_len = isset($config['page_len']) ? $config['page_len'] : 10; $this->page_len = isset($config['page_len']) ? $config['page_len'] : 10;