Selector: Configuring the Text Inside the Selector Control
The text in a
selector
control is determined by the parameters specified in the PXSelector
attribute (or a derived attribute, such as Customer
) on the DAC field. By
default, the value of the SubstituteKey parameter of the
PXSelector attribute is displayed in the
selector
control.
Adding Additional Text to the Default Text
You can add additional text to the selector element. This text will be shown after the
default text, separated by a hyphen. To add the additional text to the text box, specify the
field that contains the additional text in the DescriptionField
parameter
of the PXSelector attribute (or its descendants), as shown in the
following code.
[PXDefault]
[Customer(
typeof(Search<BAccountR.bAccountID, Where<True, Equal<True>>>),
Visibility = PXUIVisibility.SelectorVisible,
DescriptionField = typeof(Customer.acctName),
Filterable = true)]
...
public virtual Int32? CustomerID
Replacing Default Text
You can replace the identifier from the SubstituteKey parameter with more human-readable text that is specified in the DescriptionField parameter value of the PXSelector attribute. To replace the default text (within the link) with a human-readable field, you can do one of the following:
- In the DAC code, on the DAC field, in the PXSelector attribute,
specify
SelectorMode = PXSelectorMode.DisplayModeText
. - In the HTML code, in the field tag, specify
displayMode = "text"
(see the descriptions of other possible values in Selector: Reference). - Only for a grid column: In the TypeScript code, in the
@columnConfig
decorator, specifydisplayMode: GridColumnDisplayMode.Text
.
If you need to specify which field should be displayed in the column selector explicitly, you can specify the field in the textField tag, as shown in the following example.
@columnConfig({
hideViewLink: true,
textField: "ShipmentPlanType_INPlanType_LocalizedDescr" })