Friday, September 13, 2013

Adding Interactive Report Paging

Many reports have the potential of displaying an overwhelming number of rows. While viewing all these rows is sometimes necessary, in most cases, displaying only a “page” of the report is more appropriate. Logi Studio provides excellent support for displaying only one report page at a time while allowing the user to interact with the report to navigate through the its pages.    

We want to use some nice navigation buttons for this purpose and so you’ll first need to add the button images to your project. To do this, select the Support Files tab in the Application panel. Right-click the Image item and select Add Existing File… from the pop-up menu:

Figure 2.33: Support Files tab in the Application Panel
In the browser, navigate to and select:
C:\Program Files\LogiXML IES Dev\AME\LgxPackages\page_first_en.gif   

Repeat the process for all four “page_” files. When complete, the Support Files tab should look like this:

Figure 2.34: Support Files tab with all four images added
Now switch back to the Definitions tab and our report definition. To implement interactive paging to a report, add the Interactive Paging element to the Data Table element, as shown below: 

Figure 2.35: Definition Editor Panel after adding InteractivePaging element
This is another element that does not have an ID attribute. Set the other attributes as shown below. Note that when you select the First Page Caption attribute, the names of the images you just added to your project appear in the Suggestions panel. 

Figure 2.36: Attributes Panel after setting InteractivePaging element attributes
Hint: The easiest way to add interactive paging is to use the “Add interactive paging controls” wizard available in the Suggestions panel when the Data Table element is selected. 

If you use the wizard, it will automatically place the navigation button image files in the Support Files/Images folder in the Application panel for you. If desired, these images can be replaced with custom images. 

The Page Row Count attribute controls the number of rows displayed on each page. The Caption Type attribute determines whether the paging controls are text or images. If the Caption Type attribute is set to “Image”, then the First/Last/Previous/Next Page Caption attributes define the images to display for the corresponding paging controls. If the Caption Type attribute is set to “Text”, then the First/Last/Previous/Next Page Caption attributes define the text to display for the corresponding paging controls.  The Location attribute controls the location of the paging controls. Valid values are “Top”, “Bottom”, or “Both”.  And, the Hide When One Page attribute controls whether the paging controls are displayed whenever the report consists of a single page. 

Each page optionally displays a page number caption indicating the current page number, and the total number of pages (i.e. Page 2 of 45). The Show Page Number attribute controls whether the page number caption is displayed. Even the page number caption can be customized using the Page Number Caption and/or Page of Caption attributes. The Page Number Caption attribute defines the text to display in place of the word “Page” in the “Page x of y” caption. And, the Page of Caption attribute defines the text to display in place of the word “of” in the caption.    

The end result of all this looks like:

Figure 2.37: Report Preview Panel
Note that only 20 records are being displayed. Clicking the paging buttons allow you to navigate through the report and entering the page number takes you directly to the specified report page. 

Hint: We’ll discuss how to remove the border around images on the report in a later chapter. 

 

No comments:

Post a Comment