UpdateGridControl
The UpdateGridControl is a specialized netFORUM control that places a data grid on a Form. The data grid allows the user to add and edit child records of the parent record, as well as the parent record itself, simultaneously in one operation.
The UpdateGridControl allows you to add a new record and multiple child records of that parent record, simultaneously. Suppose, for example, that we have a simple data model with a table for a TV Network (the parent) and a one-to-many child table for TV Network Customers. We want to be able to add a new TV Network and multiple TV Network Customers on one page as shown in the following image:
Avectra.netForum.Common.UtilityFunctions
UpdateGridControls are specialized controls that operate only with parent-child relationships in which you are adding a parent and want to add multiple child records at the same time.
In this scenario, on the parent object (TV Network), we have a Data Object pointing to the TV Network Customer table; this is a one-to-many data object from the object (TV Network) of the form you want to add an UpdateGridControl, to the object (TV Network Customer) of the form you will design as a Grid Control.
See Creating an UpdateGridControl for information about setting up and using this control.
Properties
Property | Value | Description/Notes |
---|---|---|
FormKey | GUID | In the URL/Image Path/Data, you enter the FormKey of the form to show in the grid. You can enter two FormKeys, separated with a semicolon, to have one form for the display on the grid, and a different form for entering the data when the "add" or "edit" links are pressed. To do this, the first FormKey will be for the grid display, and the second key will be for the add/edit form. You can also enter an AddLink value to define the URL which should be used for the add button. |
EditFormKey | GUID | Specify the Formkey to use if the Edit or Add button is selected. |
NoRecordsMessage | string |
If supplied, this message will be shown when there are no records in the result set. |
SelectControlsOnly | boolean |
When set, the SelectCollections method (which builds the DesignedList) will construct a T-SQL SELECT command that contains only fields which match the controls on the form definition. The command also will select the primary key for each joined data object, as they’re needed by the facade class. |
EnableSqlPagination | boolean |
This will call a SelectCollections override that eventually constructs a SQL statement with the appropriate FETCH and OFFSET parameters to load only what’s needed for a particular page of data. |
RecordsPerPage | integer |
Specify the number of records per page to display. You can offer the number of records as an option on the page by specifying or a set of integers separated by commas. For a list of integers, a drop-down list is rendered on the page, and the first number defined is the default. |
FilterableColumns |
string |
List the controls to allow filtering, by specifying one or more column names, separated by commas. This renders a form at the top of each page with ‘filter controls’ for each field specified. |
SortableColumns | string |
List the fields that allow sorting. Each field is added to a drop-down list on the top right of the page. Selecting an entry sets the sort value and refreshes the data. |
Sortable[fav_order] |
In the advanced properties, set filters in the WHERE clause to show only the logged-in user’s own favorites. The framework knows how to select the records based on the Update Grid form. netFORUM allows for sorting many of the integer sort orders in the Toolkit with Sortable Update Grids. |
|
GroupedColumn | string |
Specify a single column to use as the group-by column for the grid. Only one column can be used to group the data. The group must be contained within a jQuery accordion section that is expandable when clicked. |
Advanced Controls
Ability to select only relevant columns
Ability to enable SQL pagination (SQL Server 2012 or later).
Migration
Forms are included in the upgrade scripts for build 2013.1 and later.
FAQ
Q. Can I specify a sort?
A. Yes, on primary table only.
Q. Does udpategrid consider the delete flag?
A. No. To include the delete flag filter, you can override the where clause.
Q. Can I sort on a column in another table?
Here is the SQL code from the thumb image:
SELECT ivw_key FROM oe_inventory_x_warehouse JOIN oe_product ON prd_key = ivw_prd_key LEFT JOIN oe_merchandise ON mer_prd_key = prd_key LEFT JOIN oe_publication ON pub_prd_key = prd_key LEFT JOIN oe_product_kit ON kit_prd_key = prd_key LEFT JOIN su_subscription_issue ON sui_prd_key = prd_key WHERE ivw_whs_key={whs_key} AND ivw_delete_flag=0 AND prd_delete_flag=0 AND (mer_delete_flag IS NULL OR mer_delete_flag=0) AND (pub_delete_flag IS NULL OR pub_delete_flag=0) AND (kit_delete_flag IS NULL OR kit_delete_flag=0) AND (sui_delete_flag IS NULL OR sui_delete_flag=0) ORDER BY prd_namex