Constructor
new CTable()
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
this.props.endpoint |
string | Url to endpoint. | |||||||||||||||
this.props.params |
Object | Additional parameters to select query | |||||||||||||||
this.props.no_pagination |
undefined | Boolean | Disable pagination. | |||||||||||||||
this.props.tabs |
Array.<String> | Tabs names. | |||||||||||||||
this.props.filters |
Object | Set presistent filter as column => value. | |||||||||||||||
this.props.columns |
Array.<Object> | List of columns. Each column will be passed as props to column object.
Properties
|
- Source:
Methods
change_filter_for_column(col, value)
Change filtering for column.
For call from column class. Reload table.
Parameters:
Name | Type | Description |
---|---|---|
col |
int | Column number. |
value |
* | Filter value. |
- Source:
change_search_for_column(col, value)
Change searching for column.
For call from column class. Reload table.
Parameters:
Name | Type | Description |
---|---|---|
col |
int | Column number. |
value |
* | Search value. |
- Source:
change_sort_for_column(col, value)
Change sorting for column.
For call from column class. Reload table.
Parameters:
Name | Type | Description |
---|---|---|
col |
int | Column number. |
value |
string | Sort order: "ASC", "DESC" and "" for no sorting. |
- Source:
column_by_name(name) → {int|null}
Getting column index by column name.
For call from column class.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Column name. |
- Source:
Returns:
Column index in current table or `null`.
- Type
- int | null
delete_row(row)
Delete row action.
For call from column class. Reload table.
Parameters:
Name | Type | Description |
---|---|---|
row |
int | Row number. |
- Source:
edit_row(row)
Toggle row editor interface.
For call from column class.
Parameters:
Name | Type | Description |
---|---|---|
row |
int | Row number. `-1` for new record. |
- Source:
notify_changes(col, row, value)
Notify that value in editor is changed.
Value stored in table cache and will be sended then `save_row` called.
All subscribed widgets will be notifed by `on_changes` call.
For call from column class.
Parameters:
Name | Type | Description |
---|---|---|
col |
int | Column number. |
row |
int | Row number. -1 in new row. |
value |
Any | null | Value. Set null - reset changes. |
- Source:
notify_valids(col, row, is_valid)
Notify that value in editor is valid or invalid.
If any editor notified about invalid value, row will not be saved.
For call from column class.
Parameters:
Name | Type | Description |
---|---|---|
col |
int | Column number. |
row |
int | Row number. -1 in new row. |
is_valid |
Boolean | Validation status. |
- Source:
open_subtable(row, keys, config)
Open subtable in table.
For call from column class.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
row |
int | Row index. | |||||||||
keys |
Array.<List> | Constrains for subtable.
Properties
|
|||||||||
config |
Object | Subtable props including columns. |
- Source:
reload()
Reloading table data.
- Source:
row_changes_summary(row, only_changes) → {Object}
Getting row with unsaved changes.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
row |
int | Row index. -1 in new row. | |
only_changes |
Boolean | false | Getting only changes or full row with changes. |
- Source:
Returns:
Unsaved values.
- Type
- Object
save_row(row)
Save row action.
For call from column class. Reload table.
Parameters:
Name | Type | Description |
---|---|---|
row |
int | Row number. `-1` for new record. |
- Source:
subscribe_to_changes(row, col, ref, obj)
Subscribe editor to notification about other column changed.
Editor should provide ref for unsubscribe if closed.
For call from column class.
Parameters:
Name | Type | Description |
---|---|---|
row |
int | Current row number. -1 in new row. |
col |
int | Observed column number. |
ref |
PreactRef | Reference to editor. |
obj |
CTableColumn | Object to interact. |
- Source:
visible_column_count()
Return count of visible columns.
- Source: