Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Select All check box not working for grid pagination

SA-21835

Summary



A grid is designed with pagination specified at 20 or more records with results displayed for 10 records per page. The first ten records are displayed and when user selects Select All check box (from header), the records are selected. When user navigates to the second page of the grid, the next ten records are displayed but they are not marked as Selected even though the Select All check box is selected.

Error Messages



Not Applicable

Steps to Reproduce

  1. Design a grid with pagination.
  2. Add the Select All check box to the grid.
  3. Test run the work form with the paginated grid and Select All check box.

Root Cause



The paginated grid with the Select All check box works as designed, but the application contained faulty Java code in the activity controlling the grid pagination.


Resolution

In an ideal scenario, when user paginates from first page to the second page, the Select All checkbox (in the header) should be unselected.
If user's expectation is to have all checkboxes selected across the grid, this will greatly have impact on performance. Hence, this needs to be designed as per requirement.


Perform the following local-change to select/unselect SelectAll checkbox based on the checkboxes status in the current page:
  1. Write an activity by opening the grid Properties > Operations tab > Advanced configuration > Run activity after grid update.


2. In the activity, include a When condition param.gridAction == "PAGINATE" and specify the Java code shown after the image:



//Logic:
ParameterPage paramPage = tools.getParameterPage();
int startIndex = paramPage.getAsInteger("startIndex");
int pyPageSize = paramPage.getAsInteger("pyPageSize");

// Check all check boxes in the page
int dataPageSize = myStepPage.getProperty("pxResults").size();
int applSize = (startIndex+pyPageSize) > dataPageSize ? dataPageSize : (startIndex+pyPageSize);
boolean selected = true;
for (int i=startIndex; i<applSize; i++) {
ClipboardPage temp = myStepPage.getProperty("pxResults(" + i+ ")" ).getPageValue();
//pySelected is the property associated with the checkbox
if (!temp.getBoolean("pySelected")) {
selected = false;
break;
}
}

// Set the 'Select All' check box accordingly
tools.findPage("pyWorkPage").getProperty("pySelected").setValue(selected);


Please note that the above logic might not work when Sorting is enabled on grid as the results vary on the page when user sorts the grid.

To make it work, user needs to have an additional step in the activity with When condition
param.gridAction == "SORT" and have the above java logic.



Published May 5, 2017 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us