How to create an O4W dialog box using local pagination


If you are building a dialog box or using an existing popup in O4W with a high record count you may want to consider building each page of the dialog box locally.  This will save on the time it takes the browser to build the dialog box because it will only need to build one page at a time.  The way it works is you set the default paginator, on the O4W Configuration screen, to one of the local paginator choices, or (alternatively) you set the ‘overridePage’ parameter in the O4WTablePagerOptions API to ‘O4WI_TABLEPAGERLOCAL’.  Setting this flag will send an event to your O4W program when the next/previous arrows are clicked as well as any time a column is clicked that is set for sorting.

Use the following image of a dialog box for reference:


The following code is used to build and maintain the above dialog box, the key to making this work is setting all the parameters in the O4WTablePagerOptions and then using that as a parameter in the O4WTableStart API:


The loop above only displays the data needed for the first page of the dialog box.
The first event ‘TABLE_BUILD_PAGE’ is generated when the table is first being built and when the next/previous buttons are clicked:


At this point you can grab the start row and the number of rows after that to return for the next page.  Then you can use that information in the buildDialog subroutine to determine which part of the array to return for the next page of the dialog.  For example, if you are displaying 10 rows per page and you are currently on the first page then when the next page comes through start_row will be 11 and num_rows will be 9.  In the buildDialog subroutine it determines that the end_row will be “start_row + num_rows” which means the data arrow of rows to return will be 11 through 20.

The second event ‘TABLE_SORT’ is generated when any sortable column header is clicked on.  To make a column header sortable pass an @tm delimited array in the third parameter of the O4WTablePagerOptions using a 1 if you want the column to be sortable (see sortCols variable in the previous code example):


This event allows you to retrieve the sort direction and the sort column.  Once you have this information you should sort the data, and store the sorted keys, using any method you prefer.  One option is to use V119 like below:


Here I am adding the column that is to be sorted to the beginning of the array for use with V119.  Once sorted V119 is used again with Function Code ‘E’ to remove the added column.  After this is complete the buildDialog subroutine can be used again to display the first page of the array in the new order. 

Basically this method gives you all the tools you need to manually build your dialog box one page at a time to enhance the speed of its creation.

Download source code HERE

Click HERE to run this program

Revelation Conference

The previous Revelation Software Users' Conference was held at the Omni Orlando Resort at Championsgate in Orlando, Florida on April 18-21, 2016.

Click Here

On The Road

Throughout the year Revelation Software attends various multivalue User Conferences as well as our Regional User Group meetings.

Click Here

International Offices

Revelation Software has various International Offices and sales regions located on multiple continents.

Click Here

Featured Clients

Revelation Software's clients are involved in every industry around the world. Here is a sampling of some of our clients and their businesses

Click Here