Fork me on GitHub

Le composant de pagination


This example demonstrates the built-in pagination component.

In addition to the user component, a pagination component is provided by the library. The later is bound to a DOM element using the attr()->pagination() call.

The HTML code.

<div class="row">
    <!-- Custom attribute: Component for paginated content. -->
    <div class="col-md-12" <?= attr()->bind(rq(PageContentCp::class)) ?>>
    </div>
    <!-- Custom attribute: Component for pagination links. -->
    <div class="col-md-12" <?= attr()->pagination(rq(PageContentCp::class)) ?>>
    </div>
    <div class="col-md-12 buttons">
        <button type="button" class="btn btn-primary" <?= attr()
            ->click(rq(PageContentCp::class)->show()) ?>>Refresh</button>
    </div>
</div>

The exported class

The Jaxon library config

The Jaxon setup code.

<?php

jaxon()->app()->setup(configFile('pagination.php'));
The Javascript code is generated from this PHP template.

jaxon.dom.ready(() => {
    <?= rq(PageContentCp::class)->show() ?>;
});