Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

GridCard Function

The GridCard pattern is a low-level building block pattern and it is used by the GridDeck and SelectDeck function patterns.

GridCard implements retrieval of records from a database table displaying these records in a Grid table in a WML Card.  GridCard contains a Position and a Next WAP Event Handler to facilitate browsing the database table.

The number of records shown in the Grid is determined by the WsyGrid<GridCount> field.  By default this field is set to the number of records retrieved by the called BlockFetch function, but the value can be overwritten in the 0 Before loop in grid edit point in the action diagram.

Example:

MyListDeck is a FNC DeckGenerator
input VW
...for VAR
...contains SYS
EntityX.Update
Input
Keys
includes FNC MyListCard
MyListDeck.MyListCard is a FNC GridCard
replaces VW
...by VW
UIBasic.Grid
EntityX.Fetch

In order to use the GridCard pattern, it is necessary to incorporate the Card Generator in a Deck Generator and replace the UIBasic.Grid view with the view from which to access the database table.

By inputting the key fields of the entity to the Deck Generator, these fields will be transferred to the List Card Generator where they are used for positioning in the Grid list.

The Position and Next WAP Event Handlers by default call the Deck Generator function scoping the Grid Card, and mapping with the WebInput variable.  This default call can be overwritten by specifying an alternative call in the 0 call to build of document edit point followed by a +++undefine for the +CallDefaultDeck meta-field.

The Position and Next Event Handlers must be declared by calls-triples from the WAP Dispatcher function.

Often, only one or two field columns should be displayed in the Grid (and not all the fields defined on the entity).  The superfluous fields can be removed directly from the generated Deck Template or they can be removed from the Grid by the following triples:

Example:

MyListDeck.MyListCard local view VW
...for VAR
...omit FLD
EntityX.Fetch
OmitGridFields
MyDisplayField

Usually, the field (or fields) being displayed is some kind of name field identifying the records.