Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Multiple Grids on Page

The Need for Multiple Grids on the same HTML Page

Standard Websydian Page Generators only provide the possibility of one Details region and/or one Grid region on each generated HTML page. However, sometimes an application will need to generate HTML pages containing more than one table of Grid data on the same page.

This paper describes how to implement Page Generators generating HTML pages containing two or more grids on the same page. See also the paper Nested Grids on Page.

How to Specify Multiple Grids on an HTML Page

The standard Document Template in Websydian contains one Details and/or one Grid region. These two regions correspond to the WsyDetails and WsyGrid local variables in the Page Generator function.

However, Websydian does make it is possible to generate HTML pages with two or more Grids on the same page. This is done making one Page Generator call one or more other other Page Generators. The resulting HTML page  will then contain the sum of the results of the individual Page Generators, while each Page Generator will still contain no more than one Grid.

The step-by-step instructions below show how multiple grids are implemented in Websydian. En the example used, it is assumed that the two Page Generators GridPageFirst and GridPageSecond are specified in the CA Plex model, and each of them implements generation of an HTML page containing a Grid.

Modifying the Document Templates

The following changes should be applied to the Document Templates of the two Page Generator functions.

GridPageFirst Document Template

A Page Marker needs to be inserted in the Document Template of the GridPageFirst Page Generator function. When the GridPageFirst function meets this Page Marker during its page generation, it should call the GridPageSecond Page Generator function.

 

Open the Document Template of the GridPageFirst function

Locate the place to insert the second grid in the template and insert the Page Marker (e.g. /(NewGridPage)

By using the syntax of normal field replacement markers, the Page Generator function will be able to locate the marker.

GridPageSecond Document Template

The Document Template of the GridPageSecond Page Generator function should only contain the part of the template generating the Grid table. I.e. the header and the footer part of the Document Template should to be stripped off.

 

Open the Document Template of the GridPageSecond function

Remove the top and the bottom of the Document Template so that the template only consists of the tags from <TABLE> to </TABLE>

Modifications to the LoadCategories Document Template may not be done with the FrontPage HTML editor, because the <html> and <body> tags will be reinserted. Notepad should be used instead to define this simple Document Template.

Modifications to the Advantage Plex Model

The following modifications need to be made to the CA Plex model.

Define Field with Page Marker Field Value

A Page Marker field needs to be defined in the model containing a value corresponding to the /(NewGridPage) marker inserted in the Document Template.

 

Add a new field to the model and specify an appropriate type and length (e.g. inherit from WSYBASE/FieldName)

Specify a value for the new field having a literal value corresponding to the contents of the Page Marker (e.g. NewGridPage)

PageMarker fields triples

GridPageFirst Action Diagram

When the GridPageFirst function its during page generation meets the NewGridPage replacement marker, it should call the GridPageSecond function. This is specified in the User defined replacement edit point:

 

Open the action diagram of the GridPageFirst function

Specify the Page Marker field as a local field to the function

In the User defined replacement edit point, add the code below:

GridPageFirst function action diagram

 

In the User defined replacement edit point, the WorkFields<FieldName> local field contains the value of the replacement marker just fetched from the Document Template.

GridPageSecond Action Diagram

When the Document Template is stripped, the GridPageSecond Page Generator will include a "content-type: text/html" string as part of the generated HTML page. This generation can be suppressed by specifying an Exit Sub statement in the Set content type edit point.

 

Open the action diagram of the GridPageFirst function

In the Set content type edit point, add an Exit Sub statement

Completing

The necessary modifications to the Document Templates and the CA Plex model have now been made.

 

Close the action diagrams and save the Document Templates

Generate and build the two Page Generator functions

Move the compiled programs and the modified Document Templates to the environment where you run the Web application

Run the application