FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

ColdBox Pagination

Paging service

Conversion Author: Robert Cruz Conversion of original Paging plugin to coldbox 4 paging service utility. Drop in your models folder. Also now has links to go to first and last record in addition to next and previous links.

To use this service you need to create some settings in your coldbox.cfc and some css entries.

COLDBOX SETTINGS

  • PagingMaxRows : The maximum number of rows per page.
  • PagingBandGap : The maximum number of pages in the page carrousel

CSS SETTINGS:

Now using bootstraps pagination css

  • .nav aria-label="Page navigation" - The div container
  • .pagingTabsTotals - The totals
  • .pagination - The carrousel

Usage

To use. You must use a page variable to move from page to page. ex: index.cfm?event=users.list&page=2

In your handler you must calculate the boundaries to push into your paging query. inject the paging service:

property name="pagingService" inject="[email protected]";
prc.boundaries = pagingServince.getBoundaries();

Gives you a struct with the following keys:

  • startrow : the startrow to use
  • maxrow : the max row in this recordset to use. Ex: [startrow=11][maxrow=20] if we are using a PagingMaxRows of 10
  • FoundRows = The total rows found in the recordset
  • link = The link to use for paging, including a placeholder for the page @[email protected] (index.cfm?event=users.list&[email protected]@)

To render the paging carousel: Get an instance of the paging model:

p = getInstance( '[email protected]' );

Call the rederit function:

p.renderit(  FoundRows, link, page);

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Download
1.0.0 Sep 20 2016 03:04 PM Sep 20 2016 03:04 PM Ortus Solutions (ortus)

 

No collaborators yet.
     
  • Sep 20 2016 03:04 PM
  • Sep 20 2016 03:04 PM
  • 757
  • 11
  • 364