Opentaps Ajax Pagination Framework
In this guide, we will show you how to replace a static form-widget list form with an Ajax paginated form using the opentaps Form Macros pagination framework.
The screen is the Financials > Configure >> Chart of Accounts screen and displays all the general ledger accounts configured for a company. Originally, the list of accounts was created with the ofbiz form widget, but because a company typically has several hundred accounts associated with it, such a static form was not very user-friendly. It always displayed 100 GL accounts per page, and paging through was slow.
The first step is to edit screen widget XML definition and remove the references to the form widget. Edit the file hot-deploy/financials/widget/financials/screens/ConfigurationScreens.xml and look for the screen "listGlAccounts". You can remove the following lines which referenced the old form widget :
<container style="screenlet-body"> <include-form name="listGlAccounts" location="component://financials/widget/financials/forms/configuration/ConfigurationForms.xml"/> </container>
You can also remove the lines:
<set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/> <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="100"/> These are no longer needed because they were used to control the pagination of the list of GL accounts from the server side, but the opentaps Ajax pagination form macro allows the user to set pagination choices.
The second step is to set up the pagination list builder on the server side.