Available Variables for JavaScript

According to the docs, it says I can reference the variable i and it will automatically equal 0.

This variable is not referenced elsewhere in the JavaScript sections, nor is it visible in the model - is it possible to set a different variable to be globally accessed? Is this documented elsewhere and I'm not finding it?

I'm looking at using an API that doesn't fit into the offset examples for pagination, so I was going to look at a custom solution to handle pagination, but this doc example had me wondering how it was being set if it's not visible, or if it's possible to create my own global variables (still new, still researching, but couldn't find an answer for i).


Hi @keif,

In the example you linked, the i variable is defined in a separate JavaScript query (query2) which is discussed down the page in step 4. The REST API query (query1) is being triggered for every row in the table by the JavaScript query (query2) and the i variable is a counter that is passed to the REST API query's scope with the query.trigger() method's additionalScope argument (docs).


I hope that helps clear up your confusion around the i variable in this example.

If you could still use some help paginating your unconventional API queries then feel free to share how the API supports pagination and we or someone else on the community might be able to help!