Online documentation - Websydian v6.5 |
Implementing Other Uses Parts
The MultipleInputGrid pattern can be used to implement Web pages where multiple rows of Grid data are processed by a single Event Handler function. The MultipleInputGrid function scopes a ProcessGrid Event Handler function which is based on the MultipleInputEventHandler pattern.
In the guidelines below, the MultipleInputGrid pattern is used to implement a multi-update of the rows in a database table.
First, define a Page Generator function based on the MultipleInputGrid pattern:
Example:
MyUpdateProductList | is a FNC | MultipleInputGrid WebGridPage |
replaces VW ...by VW |
UIBasic.Grid Product.Fetch |
To list existing records, it is also necessary to inherit from the WebGridPage pattern.
It may also be considered to omit superfluous (non-key) fields from the read-only part of the grid, as they will appear as input fields in the grid.
Example:
MyUpdateProductList | local view VW ...for VAR ...contains SYS |
Product.Update OmitGridFields Nonkey |
The ProcessGrid Event Handler scoped under the multi-input Page Generator is based on the MultipleInputEventHandler pattern which will receive the input from the multiple rows in the MultipleWebInput variable.
Example:
In this implementation of a multi-update function, the following triples must be specified:
MyUpdateProductList.ProcessGrid | local view VW ...for VAR |
Product.Update MultipleWebInput |
local view VW ...for VAR ...contains SYS |
Product.Update Hidden Keys |
|
local view VW ...for VAR ...contains SYS |
Product.Update WebInput Keys |
The specifications above tells that all non-key records fields should appear as input fields in the input grid while the record key is received as hidden input. The WebInput triples specify the record key in order to reposition when the grid is reloaded after the update.
Do also declare the new Event Handler function by the Dispatcher:
MyDispatcher | calls FNC | MyUpdateProductList.ProcessGrid |
Code to process each row in the grid should be specified in the Process grid record edit point of the ProcessGrid Event Handler function. In this way, a call to an UpdateRow server function could be specified mapping with the field values in the MultipleWebInput variable.
Example:
In the example, the Grid Page Generator is called again and mapping should be done with the WebInput variable.
The specified multi-input function and its scoped functions must be generated and built, and the Document Template Generator must be executed from the Generate and Build window.
Note! The Document Template for this multi-input function cannot be modified with the HTML editor in MS FrontPage 98. When saving the HTML Template, the FrontPage editor will automatically re-arrange the hidden fields in the multi-input HTML form in a way that will corrupt the input data received by the Event Handler.