Skip to main content

foundation-entity-management.entitymanagement

Home > @genesislcap/foundation-entity-management > EntityManagement

EntityManagement class

Main class which defines the entity management functionality

Signature:

export declare class EntityManagement extends EntityManagement_base 

Extends: EntityManagement_base

Remarks

Connects to a backend resource and wraps up a grid which is populated with entities from that resource. The different interactions that the user can perform with the entities can be configured, examples being able to update and delete entities.

Example

Example of using the entity management system to handle counterparties

<entity-management
resourceName="ALL_COUNTERPARTYS"
title="Counterparty Management"
updateEvent="EVENT_COUNTERPARTY_MODIFY"
deleteEvent="EVENT_COUNTERPARTY_DELETE"
createEvent="EVENT_COUNTERPARTY_INSERT"
></entity-management>

Where:
- the title of the grid is Counterparty Management
- the name of the resource in the database to manage is ALL_COUNTERPARTYS
- the name of the event handler for update events is EVENT_COUNTERPARTY_MODIFY
- the name of the event handler for create events is EVENT_COUNTERPARTY_INSERT
- the name of the event handler for delete events is EVENT_COUNTERPARTY_DELETE

Properties

Property

Modifiers

Type

Description

columns

ColDef[]

Array which holds the column definitions.

confirmationMessage

string

Optional confirmation message to display before form submission. If set, a confirmation dialog will be shown when the user clicks submit.

createEvent

string

Name of the event handler on the Genesis server which handles creating an entity

createFormUiSchema

UiSchema

Enables you to supply a schema to configure an insert form.

crudActionMenuName

string

The label of the crud action menu

crudMenuPosition

CrudMenuPosition

Determines where the buttons will appear

crudMenuStyle

ActionsMenuStyle

Determines the style of the buttons

customActions

CustomAction[]

Array of custom actions that can be added to the entity management component

datasourceConfig

DatasourceConfiguration

Get the configuration which is used when interacting with the resource on the backend

datasourceType

DatasourceType

If set to 'server' it will enable Server-Side Row Model and use grid-pro-server-side-datasource for the grid of the entity-list sub-component. By default grid-pro-client-side-datasource will be used.

defaultEntityValues

Record<string, unknown>

The default values to populate the form with when the user is adding an entity

deleteEvent

string

Name of the event handler on the Genesis server which handles deleting the entity

enableCellFlashing

boolean

If false, will disable cell flashing for all cells by default, unless otherwise defined in custom colDef

enableCsvExport

{ buttonName?: string; fileName?: string; } | null

Enabling this option will enable a download button in the top-right of the header which will export the data to a csv file when clicked.

enableFilterBar

boolean

Enables filter bar component

enableRowFlashing

boolean

If true, will enable row flashing for all rows for add transactions

enableSearchBar

boolean

This attribute controls whether to enable the search-bar.

entityLabel

string

Label for the entity which is used in the title of the modal when editing the entity, on CRUD buttons and on toast notifications

formRenderers

RendererEntry[]

Array with renderers used by foundation-forms

gridAutosizing

boolean

Controls automatic column sizing on interaction. Disables manual column widths and local storage persistence of widths.

gridOptions

GridOptions

GridOptions to be passed down from application

headerCaseType

GridProCaseType

The case type to use for the header names. If not set, the default CONSTANT_CASE will be used.

hideDelete

boolean

Hides delete button

hideEdit

boolean

Hides edit button

modalPosition

'centre' | 'left' | 'right'

Determines where the modal dialog will appear on screen

persistColumnStateKey

string

This attribute controls whether and how the entity manager stores the state of the columns when the user edits them. Omit this attribute to disable the functionality, set it to a unique value to enable it.

persistFilterModelKey

string

The key to use for persisting the filter model in local browser or KV storage.

prefix

string

Name of the design system prefix that will be used in renderers.

readEvent

string

Name of the request on the Genesis server which fetches data for the form, example usage could include fetching additional data that is not available in the grid but required for the selected entity

readEventFn

(entity: any) => any

Similar to readEvent but allows to provide function that will be executed before opening the form and yields data to the form

resourceName

string

Name of the backend resource which contain the entities to manage

rowSelection

string

This attribute allows you to change row-selection to 'single' or 'multiple' which will allow you to select single or multiple rows.

searchBarConfig

AvailableOption[]

Allows configuration of the search bar component, if not provided it would build configuration based on columns in the grid *

sizeColumnsToContent

boolean

Auto-sizes a column based on its contents

sizeColumnsToFit

boolean

Resizes columns to take available space

statusBarConfig

GridProStatusBarConfig

Configuration for the grid status bar components.

title

string

Title of the grid

updateEvent

string

Name of the event handler on the Genesis server which handles updating the entity

updateFormUiSchema

UiSchema

Enables you to supply a schema to configure an update form.

Methods

Method

Modifiers

Description

deleteColumnState(resetToDefault)

Deletes the saved column state for the grid

setDSConfigWithoutUpdatingBaseCriteria(config)

Usually when the datasource config is updated we need to cache the criteria so it can be combined with the searchbar, but this function allows you to set the datasource config without doing that (so we don't cache the search bar criteria)