Skip to main content

EditableTable

Special attributes

The EditableTable component requires a special property fieldConfig.

Configuration example:

{
"fieldConfig": {
"pbcToken": "",
"formEntityToken": "",
"relations": [
{
"colId": "parentDataId",
"filterType": "text",
"type": "equals",
"filter": "$CURRENT_FORM_DATA_ID"
}
]
}
}

Container properties

All component configurations support Container properties at the first level.

Component properties

NameTypeDefaultSupports Variable PatternDescription
classNamestring✔️The className of the component
styleobjectThe style of the component
simpleModeboolfalseIf true is set, all of them are sent to the request when submitting; if false is set, it will automatically be recognized as an incremental modification mode of { inserted, updated, deleted } when submitting.
columnDefsarrayThe definition of the column of the table, supporting ag-grid all columnDefs
defaultColDefobjectag-grid attributes of default column
dataUrlConditionalListOrSinglePropertyPropType(string)Get data via dataUrl.
defaultValueDataUrlstringThe default value of the table is loaded and placed in inserted
dataFiltersConditionalListPropertyPropType(DataFilters)✔️Fixed filter conditions hidden by requesting data source cannot be changed through the interface
dataResponseKeyPathstring'results'Take a certain subdata in response data as the result.
transformDataResponsestringConvert the retrieved data, use the eval expression, this points to the retrieved data.
transformDefaultValueResponsestringConvert the data obtained from defaultValueDataUrl, use the eval expression, this points to the data obtained
canAddRowbooltrueIs it supported to add rows
newRowDefaultValuesobjectAdded default value for new rows
maxRowCountnumberInfinityThe maximum number of rows that can be increased
canDeleteRowbooltrueIs it supported to delete rows
triggerDataFetchedOnGridReadybooltrueDoes the dataFetched event need to wait until grid ready to ensure that gridApi has a value before triggering

All the remaining componentsProps will be passed to the component root element(Table)。

JS API

The interface obtained through formApi.getFieldApi() is as follows:

NameTypeDescription
nodeHTML ElementThe root DOM element of the component
onfuncBind to componentevent
gridApiobjectAg-Grid's API interface, Official documentation
getComponentProps() => objectGet all componentProps of component configuration
updateComponentProps() => voidUpdate component's componentProps
refresh() => voidRefresh table data
isSimpleMode() => boolIs it simpleMode mode
getRowData() => arrayGet all data in the form
getOldRowData() => arrayGet all data before the form is edited
getChangedData() => { inserted: [], updated: [], deleted: [] }Get the modified data for table calculations
addRow(rows) => voidAdd one or more rows of new data to the table. The rows parameter does not need to have an id attribute. The table will automatically add a random id and delete it when submitting the data.
updateRow(rows) => voidModify a row or multiple rows of data in a table, and use the id in the rows data to identify which row is modified.
removeRow(rows) => voidDelete a row or multiple rows of data in the table, and use the id in the rows data to identify which row is modified.
getSelectedIds(rows) => arrayReturns an array of all ids in the selected row of the table

on eventType

NamecallbackDescription
dataFetched(formApi) => arrayTriggered when the table obtains data through the data source configuration
addRow(formApi) => arrayTriggered when a new row is added to the table
deleteRow(formApi) => arrayTriggered when a table deletes a row