To Add a Column for a Data Field
In a grid, you can create a column for a data field if the grid container is bound to a data
view declared within the graph that provides business logic for the ASPX page. To bind a grid
container to a data view, you must specify the properties as follows for the appropriate
PXGrid object:
- The DataSourceID property value must be equal to the value of the ID property of the PXDataSource control.
- The DataMember property must contain the name of the data view that is declared in the graph and provides data for the grid.
To add a column to a grid that is bound to a data view, perform the following actions:
- Open the grid container in the Screen Editor, as described in To Open a Container in the Screen Editor.
- In the Control Tree of the editor, ensure that the grid node is selected. Click the arrow left of the node to expand the node if needed.
- In the editor, click the Add Data Fields tab item (see the screenshot below).
- On the tab item, select the All, Visible (as
shown below), or Custom filter for the data fields provided by the
data view, to open the appropriate field list.Note: You can create a custom field immediately on the Add Data Fields tab item by using the Create New Field Dialog Box.
- Find the required data field in the list, and if the field is not used (that is, if the
check box in the Used column is cleared for the field), select the
check box in the unlabeled first column for the field.Note:
- You can select multiple data fields to create multiple columns simultaneously.
- In the Field Name column of the list, a data field of a
joined data access class (DAC) has a name that consists of the DAC name, two
underscore characters, and the field name, such as Product__Active. If you
create a grid column for this field, the new PXGridColumn element
refers to the field as shown in the following ASPX
code.
<px:PXGridColumn DataField="Product__Active" ... />
- On the list toolbar, click Create Controls.The platform creates a column for the selected data field, appends this column to the end of the grid column list, and adds a node for the column to the appropriate position in the Control Tree.Note: If you need to locate the new column in a position after some existing column, you can select this existing column before you click Create Controls. Then the editor inserts new grid columns after the column that is selected in the Control Tree.At any time, you can change the position of a column in a grid. See To Reorder Child UI Elements for details.
- If needed, specify the following properties of the new column:
- Type—to define a specific type of data in a column (for details, see Use of the Type Property of PXGridColumn in the MYOB Acumatica Framework Guide)
- CommitChanges—to enable callbacks on the column field (for details, see Use of the CommitChanges Property of Boxes in the MYOB Acumatica Framework Guide)
- DisplayMode—to define the mode of displaying a value in the column (for details, see Use of the DisplayMode Property of PXGridColumn in the MYOB Acumatica Framework Guide)
Note: If you need to provide hyperlinks to redirect the user from a column cell to another MYOB Acumatica form, follow the recommendations described in To Provide Hyperlinks for a Grid Column. - Click Save to save your changes to the customization project.