Using Display Page Count property


 

Objective


In grids based on attributes, K2BTools uses the “Grid.PageCount” function in order to display the total number of pages the grid has. However, there are some scenarios where this function cannot be calculated or in which performing the operation can impact system performance. 
In this page we are going to analize how to solve problems related with the use of the PageCount function.

How it works

By default when using K2BTools, in all grids based on attributes, the total number of pages is shown. To do that K2BTools uses the function Grid.PageCount.
As stated in GeneXus’ documentation the Grid.PageCount function cannot be calculated when the conditions are evaluated in the client side.
To be evaluated in the client, the conditions must involve udp or some DBMS functions. Further information on GeneXus functions evaluated in the server may be found by clicking here 

Symptoms that conditions are not evaluated on the server
In the navigation view, there is a Constrain with a warning. The server paging word does not appear as an optimization in the navigation.

DisplayPageCountWarningInNavigation
Warning in Navigation


In runtime, although there is more than one page, only one page of the grid is shown, and there is no possibility to go to the next page. 
In K2BTools versions older than 10.4, a “-1” value appears when the total amount of pages is shown. 

How to solve the problem

Our first recommendation is to try to change the condition that is calculated in the client side, so that it’s calculated in the server side. If you have any doubts on how to do this, we strongly recommend to contact GeneXus Support Team 

If it is not possible to calculate the condition on the client side, the other solution is to set the “Display Page Count” property to "False". In that case, the total number of pages will not be shown, but the user will be able to navigate through the pages of the grid.

DisplayPageCountFalseRunTime
Paging with "DisplayPageCount" set to "False"

More information

By default the “Display Page Count” property is set to true in all grids of the application. The default value can be changed in:

  • For “Web Panel Designer” objects in “WebPanel Designer” settings property “DisplayPageCount”.
  • For “EntityServices” pattern generated objects, in EntityServices settings, in “Grid” -> “”WorkWithGrid” and “Grid” -> “SubWorkWith” in “DisplayPageCount” property, for “WorkWiths” and “SubWorkWiths”
  • For “Prompt” pattern generated objects, in K2BPrompt settings,  “Grid” -> “PromptGrid” , “DisplayPageCount” property.