smallrecords
smallrecords copied to clipboard
Pagination?
Hello! My google-fu has apparently failed me on this, as this is the only reference I can find to pagination for SmallRecords. Is there anything built in to this plugin for quick pagination? I have the limit and allowlimit set, and I can operate the pages manually using the page/:slug tag in the URL, but as far as dynamic pages go, I have yet to figure out a way to design the pagination so that it works seamlessly with the plugin?
Do you happen to have some examples of how pagination was implemented with your plugin?
Hi John,
if you use Bootstrap, you can simply use:
<div>
{{ records.items.render|raw }}
</div>
Just look in default view code (at the end): https://github.com/jan-vince/smallrecords/blob/master/components/records/default.htm https://github.com/jan-vince/smallrecords/blob/master/components/records/default.htm
Best regards,
Jan
< Ing. Jan Vince / webdesigner / +420 733 127 581 / www.vince.cz />
20. 1. 2022 v 0:00, John Larson @.***>:
Hello! My google-fu has apparently failed me on this, as this is the only reference I can find to pagination for SmallRecords. Is there anything built in to this plugin for quick pagination? I have the limit and allowlimit set, and I can operate the pages manually using the page/:slug tag in the URL, but as far as dynamic pages go, I have yet to figure out a way to design the pagination so that it works seamlessly with the plugin?
Do you happen to have some examples of how pagination was implemented with your plugin?
— Reply to this email directly, view it on GitHub https://github.com/jan-vince/smallrecords/issues/94, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINT72VHRIHBIM34F2EXILUW467HANCNFSM5MLGYEWQ. You are receiving this because you are subscribed to this thread.
Can the pagination be customised for another framework such as tailwind?
Sure, but you have to create HTML by yourself.
There are methods that you can use: https://docs.octobercms.com/1.x/services/pagination.html
So at the moment I see the following.
{% if records.property('allowLimit') %}
<div>
{{ records.items.render | raw }}
</div>
{% endif %}
I have noticed in the plugins/janvince/smallrecords/components/Records.php component there is.
/**
* Limit
*/
if( $this->property('allowLimit') and $this->property('limit') ) {
return $records->paginate($this->property('limit'), $this->property('pageSlug', 1));
}
I have tried the following from the help url but it causes a white page.
{{ records.render | raw }}
Would it be possible to use something like?
{% partial 'records/pagination' %}
Paginated collection is {{ records.items }}
.
You can use methods like {{ records.items.currentPage }}, {{ records.items.lastPage }}, {{ records.items.count }}
, ... as they are documented on https://docs.octobercms.com/1.x/services/pagination.html#appending-to-pagination-links.
This way you can create your own pagination.
You can put it in a partial and call it like this: {% partial 'tools/pagination' items = records.items %}
.
Check this: https://octobertricks.com/tricks/customize-pagination-markup
Perfect thanks for all your help :)