# Grid

> Source: https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid

Note:  
The Grid option is only available when the [HTML Page](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/object-definition#formtype) check box is selected for Form Type.

The **Add a Webster+ Grid** window is used to add (and edit) a Grid control on the file maintenance HTML page only. It is not available for file maintenance NOMADS panels.

*(The ability to add/edit a Grid was added in PxPlus 2022.)*

To invoke this window, use one of the following methods:

• Click the *Add Object* button (above the *Layout Grid*) and select the *Grid* option. ***OR***

• Right click on a cell in the *Layout Grid*, select *Add Object* from the popup menu and then select the *Add or Edit a Grid* option.

The data entered in the **Column Definitions** grid is used to define the Webster+ **[\[grid\]](https://manual.pvxplus.com/webster/short-codes#grid)** and **[\[col\]](https://manual.pvxplus.com/webster/short-codes#col)** short codes, which are needed to render a Grid on the generated HTML page. See **[Using Grids in Webster+](https://manual.pvxplus.com/webster/using-grids-in-webster)**.

For an example of a Grid definition, see **[Grid Example](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid#grid_example)**.

![](https://manual.pvxplus.com/migration-assets/7103e63ac58a2597c5a833809cae0ad633e9cf37c5d7aef39f3d4f23b9d93129.jpg)

This window consists of the following:

|  |  |
| --- | --- |
| *Grid Variable* | Enter the name of the Grid variable that will be the handle to the memory file used to load the Grid.<br>The Grid must be associated with an **[HTML Interface Program](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/object-definition#program)** (entered in **Step 1: Definition**) that contains a method for loading the Grid using a memory file. The HTML interface program must contain the method:<br>LOAD\_*xxxx*<br>***Where:***<br>*xxxx* (case insensitive) is the *Grid Variable* entered (e.g. ADD_GRID_1).<br>For an example of a Grid definition with a sample **Load_MyGrid** method, see **[Grid Example](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid#grid_example)**.<br>The *Grid Variable* defaults to ADD_GRID_1, ADD_GRID_2, etc.; however, it can be changed to any numeric variable. Other events that are associated with entering values in the Grid at run time are also added to this interface program. |
| **Size** | \|  \|  \|<br>\| --- \| --- \|<br>\| *Width* \| Enter the width for the Grid either in number of *Columns* ***(Default)*** or as a *Percentage* of the column width.<br>When *Columns* is selected, the width defaults to *Auto*. In Webster+, a width of *Columns - Auto* will result in the Grid being just wide enough to display all of the columns or fill the section. To set it back to *Auto*, enter 0. Otherwise, enter the desired value or use the spinner control. Valid entries are 0 to 300.<br>When *Percentage* is selected, the percentage defaults to 100%. Otherwise, enter the desired percentage or use the spinner control. \|<br>\| *Height* \| Enter the height for the Grid in number of lines or use the spinner control. Valid entries are 0 to 255. ***Default*** is 10. \| |
| **Appearance** | \|  \|  \|<br>\| --- \| --- \|<br>\| *Grid Class* \| Controls the appearance of the cells in the Grid.<br>A single Grid Class can be entered (e.g. bold). Multiple classes can be entered, separated by either spaces or commas. When spaces are used as the delimiter, the values must be within double quotes (e.g. "bold text_red fill_cyan" or bold,text_red,fill_cyan).<br>See **[Webster+ Defined Classes](https://manual.pvxplus.com/webster/webster-defined-classes)**. \|<br>\| *Header Class* \| Controls the appearance of the Grid header row.<br>A single Header Class can be entered (e.g. bold). Multiple classes can be entered, separated by either spaces or commas. When spaces are used as the delimiter, the values must be within double quotes (e.g. "bold text_red fill_cyan" or bold,text_red,fill_cyan). If no text color is specified for the Header Class, the text color for the Grid Class will be used.<br>See **[Webster+ Defined Classes](https://manual.pvxplus.com/webster/webster-defined-classes)**.<br>*(Header Class was added in PxPlus 2022 Update 1.)* \|<br>\| *Grid Lines* \| Check box to indicate that lines will be shown between the Grid columns and rows. By default, this check box is selected. \|<br>\| *Include Drag Column* \| Check box to indicate that the first column in the Grid will be a "Drag" column, which will have a triple bar symbol that is used to drag a row up/down in the Grid. By default, this check box is not selected. \|<br>\| *Include Delete Column* \| Check box to indicate that the last column in the Grid will be a "Delete" column, which will have a trash can symbol that is used to delete a row in the Grid. By default, this check box is not selected. \| |
| **Interfaces** | \|  \|  \|<br>\| --- \| --- \|<br>\| *Initialization Program* \| The program and method (separated with a **;** *semi-colon*) that is to be run to load the Grid memory file.<br>If an **[HTML Interface Program](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/object-definition#program)** has been entered in **Step 1: Definition**, the *Initialization Program* will default to that *interface_program*+'*;load\_*'+*grid_variable* (e.g. interface_program;load_ADD_GRID_1).<br>If the Grid is being defined elsewhere in the interface program (such as the FM_INIT method), the *Initialization Program* may be left blank (shows *\<none>*).<br>*(Initialization Program was added in PxPlus 2022 Update 1.)* \|<br>\| *(Program Logic)* \| ***(Available when Initialization Program is entered)***<br>Button (beside the *Initialization Program* field) that is used to create or edit the initialization program by launching the program editor. The program editor that is launched will either be the **[Integrated Toolkit](https://manual.pvxplus.com/toolkit1/overview)**™ (\*IT) or **[Ed+](https://manual.pvxplus.com/ed-program-editor)**, depending on whether the **[%NOMADS'Program_Editor$](https://manual.pvxplus.com/nomads-graphical-application/appendix/nomads-variables/overview#programeditor)** property has been set. If this property is not set, the default will be the Integrated Toolkit. If running the File Maintenance Generator from the Web IDE, the program editor will be Ed+.<br>*(The Program Logic button was added in PxPlus 2025.)* \| |
| **Column Definitions** | The data entered in the **Column Definitions** grid is used to define the Webster+ **[Short Codes](https://manual.pvxplus.com/webster/short-codes)** on the generated HTML page.<br>For each column to be added to the Grid, define a new row with the following details:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| *Definition Type* \| Type of Grid column being defined: *Simple Variable*, *File* or *Data Class*. Defaults to *Simple Variable* for the first column when defining a new Grid.<br>To select a *Definition Type*, click the Query button *(magnifying glass)* to invoke the **Grid Column Definition Type** window:<br>![](https://manual.pvxplus.com/migration-assets/7568ec44910c473d6178da32d7d24f6e296d5876263249521c1346627ddbdc05.jpg)  <br>***All Nodes Collapsed***<br>![](https://manual.pvxplus.com/migration-assets/6a1d9a82c754f7d6111cc4296303a3385f74f20941de75369b688770f77fdc3e.jpg)  <br>***Specific Nodes Expanded***<br>This window displays a tree view and consists of the following:<br>*Simple Variable*<br>If the Grid column does not relate to a field in a data file or to a data class, select *Simple Variable*.<br>*File*<br>If the Grid column relates to a field in a particular data file, expand the *File* node and select a file from the list of data files in the data dictionary, organized by group.<br>*Data Class*<br>If the Grid column relates to a particular data class, expand the *Data Class* node and select a data class from the list of defined data classes. See **[Data Classes](https://manual.pvxplus.com/data-dictionary/data-classes/overview)**.<br>*Expand (Collapse)*<br>Toggle button that either expands or collapses the entire tree view. To collapse or expand a single "parent" node, click the corresponding **+** *plus* or **-** *minus* sign.<br>*Ok*<br>Enters the selected *Definition Type* into the **Column Definitions** grid.<br>*Cancel*<br>Cancels any selections and returns to the **Column Definitions** grid.<br>When a *File* is selected, the *Definition Type* is populated with the group and file name, and the *Variable* column drop box is loaded with fields from that file. At the same time, a new row is added to the **Column Definitions** grid with *Definition Type* defaulting to the same file name. By defining a Grid column in this way, the **[usefile=xxx](https://manual.pvxplus.com/webster/short-code-options#usefile)** option will be used with the **[\[col\]](https://manual.pvxplus.com/webster/short-codes#col)** short code, allowing additional options (i.e. format, default, etc.) to be set from the data dictionary.<br>When a *Data Class* is selected, the *Definition Type* is populated with the data class. The values for *Variable*, *Title*, *Width* and *Cell Type* default into the **Column Definitions** grid based on the data class definition; however, this can be changed. By defining a Grid column in this way, the **[dataclass=xxx](https://manual.pvxplus.com/webster/short-code-options#dataclass)** option will be used.<br>When *Simple Variable* is selected, any options that are needed must be specified in the **[Other Options](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid#other_opts)** column. \|<br>\| *Variable* \| If the *Definition Type* is *Simple Variable*, enter a unique name for the variable in the Grid definition.<br>If the *Definition Type* is *File*, select a field from the *Variable* drop box, which will be loaded with fields from the selected data file.<br>If the *Definition Type* is *Data Class*, the name of the selected data class is defaulted as the variable; however, this can be changed.<br>The variable must also correspond directly to the variable in the IOList that is used in the **[HTML Interface Program](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/object-definition#program)** entered in **Step 1: Definition** to load the memory file corresponding to the Grid. \|<br>\| *Title* \| Enter the title to display for the Grid column. \|<br>\| *Width* \| Enter the width for the Grid column. It should be wide enough to display the *Title* and the data. \|<br>\| *Align* \| Select the alignment for the data in the Grid column: *Left*, *Right* or *Center*. ***Default*** is *Left*. \|<br>\| *Cell Type* \| Select the type of cell being defined:<br>*Normal*<br>***(Default)*** Normal text cell that contains one line of data.<br>See **[\[input\]](https://manual.pvxplus.com/webster/short-codes#input)** short code.<br>*Button*<br>Contains a button.<br>See **[\[button\]](https://manual.pvxplus.com/webster/short-codes#button)** short code.<br>*CheckBox*<br>Contains a check box with no 3D effect.<br>See **[\[checkbox\]](https://manual.pvxplus.com/webster/short-codes#checkbox)** short code.<br>*DropBox*<br>Allows a selection to be made from a drop-down list.<br>See **[\[list\]](https://manual.pvxplus.com/webster/short-codes#list)** short code.<br>*Image*<br>Contains a specified image.<br>See **[\[image\]](https://manual.pvxplus.com/webster/short-codes#image)** or **[\[picture\]](https://manual.pvxplus.com/webster/short-codes#picture)** short codes.<br>*ListBox*<br>Allows a selection to be made from a list box.<br>See **[\[list\]](https://manual.pvxplus.com/webster/short-codes#list)** short code. \|<br>\| *Lck* \| Check box to indicate that the Grid column will be locked to prevent its contents from being changed. Defaults to ***On*** if *Definition Type* is a *File* and the selected field (in the *Variable* column) is defined as *Read Only* in the data dictionary.<br>Note:  <br>If a data dictionary field is defined as Read Only but the Grid column being defined should not be locked, uncheck the Lck check box and enter locked="" in the Other Options column. See [locked](https://manual.pvxplus.com/webster/short-code-options#locked) short code option. \|<br>\| *Other Options* \| Specify other short code options that are associated with the **[\[input\]](https://manual.pvxplus.com/webster/short-codes#input)** short code or other cell types (if needed).<br>See Webster+ **[Short Code Options](https://manual.pvxplus.com/webster/short-code-options)**.<br>***Examples:***<br>class=bold,text_red<br>See **[class=xxx](https://manual.pvxplus.com/webster/short-code-options#class)** short code option.<br>event=button_event<br>See **[event=xxx](https://manual.pvxplus.com/webster/short-code-options#event)** short code option.<br>format="###.00"<br>See **[format=xxx](https://manual.pvxplus.com/webster/short-code-options#format)** short code option.<br>query=scrnlib.en;client.q<br>See **[query=xxx](https://manual.pvxplus.com/webster/short-code-options#query)** short code option.<br>tip="Enter Client Name"<br>See **[tip=xxx](https://manual.pvxplus.com/webster/short-code-options#tip)** short code option.<br>Multiple options can be entered for each column with a space separating each option.<br>For an example of a Grid definition with options entered, see **[Grid Example](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid#grid_example)**. \| |
| *Insert Above  <br>Insert Below* | Adds a blank row above or below the currently selected row for creating a new column. |
| *Delete* | Removes the currently selected row, which also removes the column from the Grid being defined. |
| *Move Up  <br>Move Down* | Changes the order of the existing columns in the Grid being defined. |

## Grid Example

The example below shows a Grid definition with eight rows of data entered in the **Column Definitions** grid:

|  |  |
| --- | --- |
| • | Rows 1, 2, 3 and 5 define columns that are based on the *SalesRepCode*, *Name*, *ImagePath$* and *ytdOrders* fields in the **Salesreps** data file. |
| • | Row 4 defines a column that is based on the *Department* data class. |
| • | Rows 6, 7 and 8 define columns that are based on Simple Variables named *email$*, *image$* and *comments$*. |

![](https://manual.pvxplus.com/migration-assets/12bbc6023e9cc83148a708e19bf96e2349706278b2c2b5c03d872f75408de195.png)

The following program, which contains an event (Mail) and a method to load the grid (Load_MyGrid), was defined as the **[HTML Interface Program](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/object-definition#program)**:

```
! grid_interface demo program
!
     goto lno(_event$,err=*next)
     %webster'msgbox("Invalid event: "+_event$,"Internal Error - "+pgm(-3),"!")
     exit
!
Mail:
! code needed when Mail button is pushed
     %webster'msgbox("Pushed Mail button","Button event","!")
     exit
!
Load_MyGrid:
     enter MyGrid
     if MyGrid<>0 \
          then exit
     open (hfn,iol=*)"salesreps"
     reps=lfo
     open (hfn,iol=MyGridIOL)"*memory*"
     MyGrid=lfo
     select * from reps
          write (MyGrid)
     next record
     close (reps,err=*proceed)
     exit
!
MyGridIOL: \
     iolist SalesRepCode$,Name$,ImagePath$,Department$,ytdOrders,Email$,Image$,Comment$
```

When the HTML file is generated, the Webster+ short codes for this Grid look like this:

```
[grid MyGrid program="test_interface;Load_MyGrid" gridlines size=Auto/10 class=""]
     [col width=5 ttl="Drag" align=center event=*Rowdrag][symbol reorder][/col]
     [col usefile=Salesreps source=SalesRepCode$ ttl="Sales Rep Code" width=20 align=left class=bold,text_red]
     [col usefile=Salesreps source=Name$ ttl="Name" width=25 align=left]
     [col ttl="Image" width=6 align=center][picture file=(ImagePath$) size=6/2][/col]
     [col ttl="Department" width=24 align=left][list Department$ dataclass=Department program=*class;ClassList,"Department"][/list][/col]
     [col usefile=Salesreps source=ytdOrders ttl="YTD Orders" width=15 align=right locked]
     [col ttl="Send Email" width=12 align=left][button email$ size=auto   size=11/1.5 event=mail][symbol envelope] Email[/button][/col]
     [col ttl="Fixed Image" width=12 align=left][picture size=auto file=*plus/inomads/sysimage/book_open.png][/col]
     [col source=comment$ ttl="Comment" width=20 align=left tip="Enter Comment"]
     [col width=4.5 align=center ttl="Del"][symbol trash event=*Rowdel][/col]
     [/grid]
```

In Webster+, the Grid looks like this:

![](https://manual.pvxplus.com/migration-assets/0ea8ee047f24b86e8ff4e97a072b44c85f462851280e4043edbf68ef5c07a083.png)

This Grid shows the following, based on the **[Grid Definition](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/grid#grid_example)**:

|  |  |
| --- | --- |
| • | The *Drag* column is shown because the *Include Drag Column* check box was selected. |
| • | The Grid is loaded with records from the **Salesreps** file in the data dictionary. All the columns are populated, except for *Comments*, which is not a field in the **Salesreps** file. |
| • | The *Sales Rep Code* column contains a query button because the *SalesRepCode$* field was defined with a query in the data dictionary. The data in this column is red and bolded because a class was entered in the *Other Options* column. |
| • | The *Image* column was defined with a *Cell Type* of *Image* and contains the image referred to in the *ImagePath$* column of the **Salesreps** file with a width of 6 and a height of 2. If no size was specified in the *Other Options* column, the cell would be made large enough to fit the image. |
| • | The *Department* column shows a drop-down arrow in each cell because the *Department* data class was defined for a Drop Box control, which the *Cell Type* column indicates. |
| • | The *YTD Orders* column is locked because the *ytdOrders* field was defined as *Read Only* in the data dictionary. The data in this column is right aligned because *Right* was selected in the *Align* column. |
| • | The *Send Email* column shows a button in each cell because *Button* was selected in the *Cell Type* column. The button's size, symbol, text and event are based on the text, symbol, size and event options that were entered in the *Other* *Options* column. When the button is clicked, the mail event in the HTML interface program will be triggered. This needs to be coded to determine the email address and launch the email program. The event logic can check the *\_changed$* variable to determine the row of the grid where the button was pressed. |
| • | The *Fixed Image* column is defined with a *Cell Type* of *Image* and displays the file specified in the *Other Options* column in all rows of the Grid. |
| • | The *Comments* column shows a tip when you hover over it because a tip option was entered in the *Other Options* column. |
| • | The *Del* column is shown because the *Include Delete Column* check box was selected. |
