-
Notifications
You must be signed in to change notification settings - Fork 55
Events
Robert Hjalmers edited this page Feb 21, 2018
·
4 revisions
The table and the column-settings component emits events using gtEvent
, the events are passed in an object which looks like this:
{
"name":"gt-sorting-applied",
"value": "passed data..."
}
Currently the table emits the following events:
Name | Trigger | Data passed with event |
---|---|---|
gt-sorting-applied | sorting changed | new sort order in array ex. ["-firstColumn", "secondColumn"] |
gt-row-length-changed | record length changed | new record length ex. 10 |
gt-page-changed | page changed | current state ex. {pageCurrent: current page, recordLength: current record length} |
gt-page-changed-lazy | page changed and no data exits for new page | current state ex. {pageCurrent: current page, recordLength: current record length} |
gt-info | table info has changed (not emitted when lazy loading) | current state ex. {pageCurrent: current page, recordLength: current record length} |
gt-exported-csv | table has exported data to csv file | file name |
gt-row-click | row click (not emitted when row selection is turned on) | clicked row and mouse event ex. {row: row object, $event: mouse event} |
gt-row-select | row selected (on row clicked) | row selection ex. {changedRow: row object, selectedRows: array with selected rows} |
gt-row-deselect | row deselected (on row clicked) | row selection ex. {changedRow: row object, selectedRows: array with selected rows} |
gt-row-select-all | selectAllRows function | row selection ex. {changedRow: 'all', selectedRows: array with selected rows} |
gt-row-deselect-all | deselectAllRows function | row selection ex. {changedRow: 'all', selectedRows: array with selected rows} |
gt-row-expand | when row is expanded | row state ex. {changedRow: row object, expandedRows: array with expanded rows} |
gt-row-collapse | when row is collapsed | row state ex. {changedRow: row object, expandedRows: array with expanded rows} |
gt-row-expand-all | expandAllRows function | row state ex. {changedRow: row object, expandedRows: array with expanded rows} |
gt-row-collapse-all | collapseAllRows function | row state ex. {changedRow: row object, expandedRows: array with expanded rows} |
gt-row-updated | row object has been updated, e.g. using inline edit | changed row together with new, old and original value ex. {newValue: row object, oldValue: row object, originalValue: row object } |
<generic-table ... (gtEvent)="trigger($event)"></generic-table>
public trigger = function($event){
switch($event.name){
case 'gt-sorting-applied':
console.log($event.value);
break;
}
};
Currently gt-column-settings emits the following events:
Name | Trigger | Data passed with event |
---|---|---|
gt-column-order-change | order changed | new settings object |
gt-column-visibility-change | column visibility changed | column that changed together with new settings object |
<gt-column-settings ... (gtEvent)="trigger($event)"></generic-table>