Paging Control

This article applies to versions 4.4 and later of P2 Explorer. For more, see Release History.

Overview

Note: For this component to work with a dataset, paging must be enabled on the dataset. 

The Paging Control allows page designers to split up large amounts of tabular data into smaller chunks, or pages, to make it easier to display many rows of data in a small space. This allows the user to move through those pages to view the data in a table. 

The following screenshot shows a Paging Control being configured:

Paging Control 4.4

Page Number: The number that is published when the user clicks through the page control. This is effectively the page of data that the user is viewing. This variable is a parameter of the paging-enabled dataset.
Page Size: The number of rows of data to display in the table. This variable is a parameter of the paging-enabled dataset.
Total Record Count: The total number of records in the dataset, rounded up. This is an attribute of the paging-enabled dataset.
Style: The style you want to apply to the Paging Control component. If you are a Style Administrator, you can add a new Paging Control style.

Related: Using Data Tables in display mode, Adding a Paging Control style


About Paged Datasets

The Paging Control will only work on datasets that have been enabled for paging. This is done by modifying the dataset query in P2 Server. When a dataset is paging enabled, the configuration panel for a Data Table will display additional parameters. These are:

Total Row Count: The total number of records in the dataset, rounded up. This is always a variable (totalRowCount) that is published by the paging-enabled dataset. 
Enable Server Paging: Select this check box to indicate that you want to take advantage of dataset paging.
Page Number: The page number to display when the display is first opened. 
Page Size: The number of rows of data to display in the table. 
SortBy:

The name of the column in the dataset by which to sort the table. Columns containing text will sort alphabetically, those containing numbers will sort numerically, and those containing dates will sort chronologically. You can also specify whether you want to sort the column in ascending or descending order. Here are some examples:

  • Entity asc
    Sort by the Entity column in ascending order
  • DowntimeReason desc
    Sort by the DowntimeReason column in descending order
  • Entity asc, DowntimeReason desc
    Sort first by the Entity column in ascending order, and then by the DowntimeReason column in descending order.

Tutorial: Displaying a Paging Control for a Large Dataset Table 

If you're unfamiliar with the process of building pages, read the article Building an Explorer Page.

In this tutorial, we’ll look at adding a Paging Control component that will display pages of downtime information in a data table.

Paging 4.4

Let’s go through this process, step-by-step.

Note: This configuration uses the Sample Data table and datasets that can be optionally made available during initial installation and setup. If you don't have access to this data, you will need to adjust the configuration to suit your data at your site.

Step 1. Prepare a Studio Page

New Page button on ribbon

Before you start, click the New Page button on the Home tab of the ribbon. Choose the Grid layout.

Grid Layout 4.4

  • For this exercise, we'll keep the 4 grid cells.
  • Assign the first row a height of 450.
  • Assign the second row a height of 50.

Related: Grid Layout tutorial

 

Step 2.  Add the Paging Control component to the page

Paging 4.4

Drag and drop the Paging Control component onto a grid cell. The Paging Control is in the Display Display group icon group.

 

Step 3. Configure the Paging Control component

Paging 4.4

Configuring the Paging Control consists of assigning variables to each field. 

  • Page Number: pageNumber
  • Page Size: pageSize
  • Total Record Count: totalRowCount
    Note: totalRowCount is a special variable that is automatically published by a dataset, so you should not rename this to something else.

We will add defaults for these later in this tutorial.

Related: Variables

 

Step 4. Add and configure a Data Table

Paging 4.4

The Paging Control on its own doesn't do anything, it's designed to be used with a Data Table. Drag and drop a Data Table component onto the canvas, and configure it as follows.

Related: Data Selector, Data Table tutorial

Configuring the Data

  • Open the Data Data Selector by clicking on the field. You will notice that the Dataset Dataset icon tab is automatically selected. Staying on that tab, fill in the fields as follows:
    • Dataset Query: MiningDowntimePaged 
    • EndDate: (Variable) endTime
    • Sortby: (leave blank)
    • StartDate: (Variable) startTime
    • EnablePaging: select the check box
      Note: This check box only appears on datasets that are enabled for paging. If the check box is not present, your data cannot be paged. You will first need to modify the dataset appropriately in P2 Server.

       
    • PageNumber: (Variable) pageNumber
    • PageSize: (Variable) pageSize
    • TotalRowCount: (Variable) totalRowCount

Paging 4.4

Refresher: The following parameters are only present on paged datasets: SortBy, EnablePaging, PageNumber, PageSize, TotalRowCount. See About Paged Datasets above.

 

TOP TIP

Click the Preview button to check that you are getting data. If the preview window is blank, you may have filled in a parameter incorrectly.

 

Configuring the Columns:

You must specify the columns that you want to display, otherwise your data table will appear blank. Let's keep the data table simple, and use the Autofill function.

  • Click the Autofill button.

Paging 4.4

 

Step 5. Set the Defaults

Paging 4.4

We need to set the defaults for the pageNumber and pageSize variables in order for the Paging Control to work properly.

  • Click the Default Values button on the Studio toolbar.
  • Click the Add button.
  • Add a variable called pageNumber with a type of Number. Type in the following value: 1
    This will show the first page of data when the Explorer page is loaded.
  • Click the Add button.
  • Add a variable called pageSize with a type of Number. Type in the following value: 20
    This will page the data so that it will show 20 rows per page.

Note: You do not need to add a default for totalRowCount, as this is automatically published by the dataset.

Related: Default Values

 

Step 6. All done!  

Paging 4.4

Great work! You now have a fully functioning Paging Control that displays tabular data in pages.

  • Click the preview preview button on the Studio toolbar to see what your page will look like in run-time.
  • Click through the pages to get a feel for the behaviour of the control.
  • In the defaults, change the page number and page size to see what happens.

save Don’t forget to save your page!


Release History

Comments are closed