Skip to content

Bug: Call to undefined method CodeIgniter\Pager\PagerRenderer::getDetails() with multiple paginations in single view #6230

Closed
@jozefrebjak

Description

@jozefrebjak

PHP Version

8.0

CodeIgniter4 Version

4.1.2

CodeIgniter4 Installation Method

Composer (as dependency to an existing project)

Which operating systems have you tested for this bug?

macOS, Linux

Which server did you use?

apache

Database

MariaDB 10.6.5

What happened?

After PR #6211, I can access multiple pagers on a single page. It works when I use:

<?= $pager->links('contacts') ?>
<?= $pager->links('orders') ?>

on the same page, but when I'm trying to use template where I'm using function

$pager->getDetails($group ?? 'default')

to get details about pagination it doesn't work on the same page.

Steps to Reproduce

See #6230 (comment)

I'm using partial template for Full pagination like:

<?php
    $details = $pager->getDetails($group ?? 'default');
    $perPage = $details['perPage'];
    $showing = $perPage * $details['currentPage'];
    $total   = $details['total'];
    $from    = $showing + 1 - $perPage;
?>

<div class="row g-0 text-center text-sm-start align-items-center">
    <div class="col-sm-6">
        <div>
            <p class="mb-sm-0"><?= lang('Pager.showingResults', [
                $from < 0 ? 0 : $from,
                $showing > $total ? $total : $showing,
                $total,
            ]) ?></p>
        </div>
    </div> <!-- end col -->
    <div class="col-sm-6">
        <?= $pager->links($group ?? 'default') ?>
    </div><!-- end col -->
</div><!-- end row -->

and calling that partial from view like:

<?= view('pager/_pager', ['group' => 'contacts']) ?>
<?= view('pager/_pager', ['group' => 'orders']) ?>

I'm getting Error like:

Call to undefined method CodeIgniter\Pager\PagerRenderer::getDetails()

Expected Output

Expected is to have an option to call getDetails() from all of the groups.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions