Building on the view that was created in the last lesson to view and edit existing recipes this lesson will now add the list of ingredients to the view using grids.
From the design view of Recipe.vs [Design] in the DataFlex Studio.
Select to view the DDO Explorer in the right panel.
Select the ‘Add DDO’ icon from the top of the panel.
Select ‘cIngredientsDataDictionary’ form the list. Select ‘Select.’
Select, drag and drop ‘cDbCJGrid’ from the ‘Class Palette’ on the left onto the view.
This grid is a database aware Codejock grid
Resize the grid as needed.
Expand ‘cIngredientsDataDictionary [Constrained to cRecipe]’ in the DDO Explorer.
Check ‘Name’ and ‘Amount’
Click on ‘Name,’ and drag it into the grid.
Columns for both will be added to the grid.
Click on the bottom ‘Properties’ tab of the ‘Properties’ panel on the right, and then select the ‘Binding’ tab from the middle section.
Note that the ‘Data Server’ has automatically been set to ‘oIndredients_DD.’
The source code also shows the same.
Change the column titles in the code from “Name” to “Ingredients.”
Set psCaption to “Ingredients”
Select the ‘Run’ icon from the top toolbar to launch the application.
Select ‘View’ from the application’s top toolbar and select ‘Recipe.’
The grid is now in place showing the list of ingredients and corresponding amounts.
To further demonstrate the use of the grid a new record will be added through the application…
Select ‘Clear/Add’ from the top menu to clear the buffer.