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

The ColdBox Paginator

v2.0.0 Public

Welcome to the Pagination Module

This module builds the pagination struct for API responses and custom data tables.


Apache License, Version 2.0.


  • Adobe ColdFusion 2016+
  • Lucee 4.5 or later


Just drop into your modules folder or use the box cli to install

box install cbpaginator


This module provides two functions to build your pagination struct:


public struct function generate(
    numeric totalRecords = 0,
    numeric page = 1,
    numeric maxRows = 25

Returns the pagination struct according to the total records.

If page and maxRows parameters are not passed in, it will use the default values.

The response will look like the following:

    "totalPages": 0,
    "maxRows": 25,
    "offset": 0,
    "page": 1,
    "totalRecords": 0


public struct function generateWithResults(
    numeric totalRecords = 0,
    array results = [],
    numeric page = 1,
    numeric maxRows = settings.defaults.maxRows,
    boolean asResultsMap = false,
    string keyName = "id",
    string resultsKeyName = "results"

This function returns the same pagination struct as the above along with the results

You can convert your results to be a resultsMap by setting asResultsMap to true

In addition you can set a name for your results key by passing in the resultsKeyName value as a parameter. By default this key is called results

    "pagination": {
        "totalPages": 0,
        "maxRows": 25,
        "offset": 0,
        "page": 1,
        "totalRecords": 0
    "results": [],
    // optional
    "resultsMap": {}


Because of His grace, this project exists. If you don't like this, then don't read it, its not for you.

"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God. And not only so, but we glory in tribulations also: knowing that tribulation worketh patience; And patience, experience; and experience, hope: And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the Holy Ghost which is given unto us. ." Romans 5:5


"I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12

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 Actions
2.0.0 Mar 25 2020 09:11 AM Mar 25 2020 09:11 AM
Version History
1.4.0 Jan 22 2020 02:45 PM Jan 22 2020 02:45 PM
1.3.0 Oct 21 2019 10:55 AM Oct 21 2019 10:55 AM
1.2.0 Oct 07 2019 05:54 PM Oct 07 2019 05:54 PM
1.1.0 Aug 28 2019 12:16 PM Aug 28 2019 12:16 PM
1.0.0 Aug 27 2019 02:59 PM Aug 27 2019 02:59 PM


$ box install cbpaginator

No collaborators yet.
  • Aug 27 2019 02:50 PM
  • Mar 25 2020 09:11 AM
  • 497
  • 0
  • 4,004