A global mixin object containing methods for table editing and saving.
- Source:
Methods
(method) createEmptyRow(columns) → {Object}
Creates an empty row object with default values based on the given columns.
Parameters:
Name | Type | Description |
---|---|---|
columns |
Array | An array of column objects. |
- Source:
Returns:
- An empty row object with default values.
- Type
- Object
(method) createRowForTable(row, columns) → {Array}
Creates a row for a table based on the given row object and columns.
Parameters:
Name | Type | Description |
---|---|---|
row |
Object | The row object. |
columns |
Array.<Object> | The array of column objects. |
- Source:
Returns:
- An array representing the row for the table.
- Type
- Array
(method) findIndexOfColumn(columns, columnName) → {number}
Finds the index of a column in the given array of columns based on the column name.
Parameters:
Name | Type | Description |
---|---|---|
columns |
Array | The array of columns to search. |
columnName |
string | The name of the column to find. |
- Source:
Returns:
- The index of the column if found, otherwise -1.
- Type
- number
(method) getValueType(value) → {string}
Returns the type of the given value.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value to determine the type of. |
- Source:
Returns:
The type of the value. Possible values are "boolean", "json", or "text".
- Type
- string
(method) prepareRow(row, columns)
Prepare row for saving : converts JSON strings to objects, blanks to nulls.
Parameters:
Name | Type | Description |
---|---|---|
row |
Object | The row object. |
columns |
Array.<Object> | The array of column objects. |
- Source:
(method) saveRowToDb(editMode, tableAPI, columns, editingRow, editingRowIndex, rows, customAPI, customMethod) → {Promise.<void>}
Saves the edited row to the database.
Parameters:
Name | Type | Description |
---|---|---|
editMode |
string | The edit mode ('add' or 'edit'). |
tableAPI |
string | The API endpoint for the table. |
columns |
Array | The columns of the table. |
editingRow |
Object | The edited row. |
editingRowIndex |
number | The index of the edited row. |
rows |
Array | The rows of the table. |
customAPI |
string | The custom API endpoint for the table. |
customMethod |
string | The custom method to use for the API request. |
- Source:
Returns:
- A promise that resolves when the row is saved to the database.
- Type
- Promise.<void>