Defining the Detail View
The Detail View has most of the functionality and properties characteristic of a regular grid. You therefore have many options in shaping both the appearance of the Detail View and what it is capable of doing. You can define your Detail View's fields and properties on the Detail View > Fields and Detail View > Properties pages. These pages open automatically when you select the Grid contains a Detail View checkbox on the Component Type page.
Open the Grid Builder .
Open the Component Type Page, click Grid is:Read Only , and check the Grid contains a 'Detail View' partcheck box.
As with a grid, you must define the type of data you will use and the table from which the data will be drawn. Open to the Data Source page and choose .dbf or SQL for your data type.
Go to Grid > Query (DBF) or Grid > Query (AlphaDAO) and establish which .dbfor SQLtables you will use..
Display the Detail View > Fields page.
Select fields in the Available Fields list and move them to the Selected list, as you would with any grid. Use the arrow key to move them. If you are using AlphaSports Customergrid, for example, select the " Customer_Id", " Firstname", " Lastname", Company", and " Phone" fields and then click .
Check the Detail view is editablecheck box.
Click OK to change all the fields on the Detail View to editable TextBox controls.
On the Grid Builder Design page under Grid open the Properties page .
Display the Grid > Fields page.
Select a field in the Selected Fields list, like Customer_ID, and look at the Field Properties list on the right side of the Fields page.
2. The Select Control Type dialog will open. Change the Control from 'Textbox' to ' Link '. The Customer_Idfield will uniquely connect each record in the grid to its detail view.
3. Below the Display Settings section you should now see a Link Properties section open.
4. Under the Link Properties find the Link addresstype property. Click the dropdown and select " DetailView link ".
Change the labels used for the Firstnameand Lastnamefields.
Click Save and close the Grid Builder. This returns you to the HTML Editor.
In some applications, you might want to set the default value for a field in a new record to be the same as the value in the previously entered field. Here is how you can to this: This example shows how you can make the lastname field in a new record use the previously entered lastname as a default. Obviously, when you adapt this for your own use, you could define defaults for as many fields as you wanted. In the AfterInsertRecord event in the Grid builder, define this code:
function AfterInsertRecord as v (e as p) e.rtc.mydata.lastname = e.datasubmitted.lastname end function
In the OnIntialValueCalculate event, define this code:
function onInitialValueCalculate as v (e as p) dim e.rtc.mydata.lastname as c = default "" if e.rtc.mydata.lastname <> "" then e.newvalues.lastname = e.rtc.mydata.lastname end if end function
See Also: Grid, Dialog and Custom Components Storing state information