A fully populated Web List row.
Function LoadGridRow Returns tWebRow
Call: | Get LoadGridRow to tWebRowVariable |
LoadGridRow can be used as a helper function within the OnManualLoadData event handler. Typically, you would use LoadGridRow if you are manually loading the row data of a data-aware grid/list (i.e. peDbGridType = gtManual).
Within OnManualLoadData, you would read each record into the Server DataDictionary, then send LoadGridRow to populate the tWebRow struct with all the relevant column information as defined by each column object. This process will query each columns: data binding, manually calculated value (OnSetCalculatedValue), custom tooltip, and custom CSS class.
The sample below demonstrates how to use LoadGridRow to populate a manually loaded grid that is data-aware (connected to a server data dictionary).
Object oInventoryListView is a cWebView Set piColumnCount to 10 Set piWidth to 700 Object oInvt_DD is a Invt_DataDictionary End_Object Set Main_DD To oInvt_DD Set Server To oInvt_DD Object oGrid is a cWebGrid Set piHeight to 500 Set peDbGridType to gtManual Object oInvt_Description is a cWebColumn Entry_Item Invt.Description Set psCaption to "Inventory Item" Set piWidth to 75 End_Object Object oInvt_On_Hand is a cWebColumn Entry_Item Invt.On_Hand Set psCaption to "On Hand" Set piWidth to 20 End_Object Object oInvt_Unit_Price is a cWebColumn Entry_Item Invt.Unit_Price Set psCaption to "Unit Price" Set piWidth to 30 End_Object Procedure OnManualLoadData tWebRow[] ByRef aTheRows String ByRef sCurrentRowID aTheGroups ByRef tWebGroupHeader[][][] ByRef aTheGroupHeaders // Loads the first 10 inventory items. Handle hoDD RowID riRowID String sRowID Integer iRow // Establish the find ordering and find the first record. Move 0 to iRow Get Server to hoDD Get ReadDDFirstRecord hoDD 1 False to riRowID // Find remaining records.... While (Found and (iRow < 10)) // We use the LoadGridRow function to fill the row struct // based on the DEO values Get LoadGridRow to aTheRows[iRow] Increment iRow Send Locate_Next to hoDD Loop // Set the first row to be the selected row If (IsNullRowID(riRowID)) Begin Move "" to sCurrentRowID End Else Begin Send FindByRowId of oInvt_DD Invt.File_Number riRowID Move (SerializeRowID(riRowID)) to sCurrentRowID End End_Procedure Procedure OnLoad Send GridRefresh End_Procedure End_Object End_Object
LoadGridRow is particularly useful in this context as it correctly loads all of the row attributes according to each column's properties. If you modify column properties (tooltip or CSS class for example) or you add or remove columns from your grid, you do not need to adjust the code in OnManualLoadData as LoadGridRow is self-adjusting.