Paging Assistant Builder
In this topic ...
Using the Paging Assistant LJO
Related Topics ...
Javadoc for the PagingAssistant class
How to Use the Paging Buttons Builder
The Paging Assistant builder provides you with the ability to navigate through a data set. It adds an LJO to the WebApp that wraps the specified data source in an IXml object and contains methods to access records one "page" at a time or one record at a time. Use either a Paging Links or Paging Buttons builder call to add the data navigation controls to the page.
Using the Paging Assistant LJO
The Paging Assistant builder call adds an LJO to your WebApp that provides you with a set of methods used to to get information about the IXml object on which the Paging Assistant operates as well as navigate through that data. To view the available methods, highlight the Paging Assistant builder call in the Builder Call List and examine the builder_Call_NamePagingAssistant LJO in the WebApp view.
For example, the Paging Assistant LJO has a reset() method we can use to re-initialize the data on which the Paging Assistant operates as well as a getUpdatatedData() method used to to refresh the data on which the Paging Assistant operates. (For more information about these methods, see the PagingAssistant class Java Doc.
Quick Tips
- Displaying data managed by the Paging Assistant -- In the builder call that you are using to display the data, set the Source Data to the PagingAssistantNameData variable. For example, if you name the Paging Assistant builder call PA, the name of the source data variable to use is: PAData.
Typically, the Source Data input is set to the XML element that contains the data over which a table row or repeated region repeats. However, this is not the case when using the Paging Assistant. The Data variable "contains" the actual data over which the row repeats.
Specifying Inputs
The Paging Assistant builder takes the inputs described in the table below. For help on inputs common to many or all builders such as those in the Properties and HTML Attributes input groups, see Using the Builder Call Editor.
Input Name Description Name Enter a name for this builder call. The Designer displays this name in the Builder Call List. Source Data Type Enable the radio button that represents the type of data source you want to use.
- Database -- Specify the name of a valid JNDI DataSource.
- Service Call -- Specify the name of the service call that returns the data to display.
- Variable -- Specify the name of the variable that contains the data to display.
- Reference -- Use the Reference Chooser to specify a method or Java expression that returns the data to display.
- Custom -- Specify the name of an LJO whose Java class implements the com.bowstreet.builders.webapp.methods.DataRetriever interface. Use the Custom option when you want to perform your own data retrieval. See "Implementing a Custom Data Retriever," for more information.
Source Data Use the select box to choose one of the available options. The select contains all the available options of the type you specify for the Source Data Type. For example, if the Source Data Type is set to "Variable," the select options only include variables of the XML Data type. Page Size Number of records to fetch per page. If you are using the Paging Assistant in conjunction with a Dynamic Table builder call, be sure that the Paging Assistant's Page Size value and the Dynamic Table's Row Count value are the same. Otherwise, the Paging Buttons or Paging Links will not correctly indicate the row numbers being displayed.
Check for New Data Enable this check box to force a check for changes in the data prior to each data re-fetch from the data variable. If the data has changed, the data variable will be refreshed with new data.
Preserve Location Enable this check box to maintain page context when data changes. When enabled, builder will retain current page setting rather than reset page to 0. Advanced Auto-initialize data If true, the data source will be asked to fetch the initial data; if false, the data variable is assumed to have been already populated. Variable Schema Specify a data type or schema path the schema type to be used for creating the Data variable. This input is only necessary when the Data Source specified is an LJO that implements the DataRetriever.
Implementing a Custom Data Retriever
If your data source can only provide a certain number of records per request or if you want to be able to dynamically retrieve data based on user input, we can create your own Java class that works as the data retriever for the Paging Assistant.
We can implement your own data retriever to be used by the Paging Assistant by creating a Java class that implements the com.bowstreet.builders.webapp.methods.DataRetriever interface and adding an LJO for that class to the model. The Factory includes a sample DataRetriever implementation:
- Java source file -- WEB-INF/work/source/com/bowstreet/examples/datapaging/DirectoryListDataRetriever.java
- Sample model -- WEB-INF/factory/samples/datapaging/CustomDataRetriever