fieldUtils
Reference
Utilities for working with field (column) configuration arrays used in grid and layout widgets.
const { protrakUtils } = React.useContext(customWidgetContext);
const { getVisibleUniqueFields } = protrakUtils;
getVisibleUniqueFields(fields)
Filters an array of field configuration objects to return only fields that are visible (isVisible === true), and removes duplicates based on the combination of fieldType + attributeName.
Parameters:
| Param | Type | Description |
|---|---|---|
fields | Array | Array of field configuration objects |
Returns: Array — Filtered and deduplicated array of visible fields.
Field object shape:
{
fieldType: 'Attribute', // string
attributeName: 'AgreementTitle', // string
attributeType: 'Text', // string
label: 'Agreement Title', // string
isVisible: true, // boolean — must be true to be included
isEditable: false,
isRequired: false,
width: 200,
formatConditions: [],
// ...other grid config fields
}