如果列发生变化如何获取事件?

问题描述 投票:0回答:1

我使用 PrimeNG 表,并且还有一些列的选择。

正如示例所示。

https://primeng.org/table#column-toggle

现在,如果列发生更改(之后),我需要获取一个事件 - 由于原因。

我怎样才能获得该事件?

javascript angular primeng primeng-datatable
1个回答
0
投票

正如您在 官方仓库 中看到的,这些是

table.js
提供的唯一 @Output

没有任何内容通知列内的更改事件

/**
 * Emits when the all of the items selected or unselected.
 * @param {TableSelectAllChangeEvent} event - custom  all selection change event.
 * @group Emits
 */
@Output() selectAllChange: EventEmitter<TableSelectAllChangeEvent> = new EventEmitter<TableSelectAllChangeEvent>();
/**
 * Callback to invoke on selection changed.
 * @param {any | null} value - selected data.
 * @group Emits
 */
@Output() selectionChange: EventEmitter<any | null> = new EventEmitter<any | null>();
/**
 * Callback to invoke when a row is selected.
 * @param {TableRowSelectEvent} event - custom select event.
 * @group Emits
 */
@Output() onRowSelect: EventEmitter<TableRowSelectEvent> = new EventEmitter<TableRowSelectEvent>();
/**
 * Callback to invoke when a row is unselected.
 * @param {TableRowUnSelectEvent} event - custom unselect event.
 * @group Emits
 */
@Output() onRowUnselect: EventEmitter<TableRowUnSelectEvent> = new EventEmitter<TableRowUnSelectEvent>();
/**
 * Callback to invoke when pagination occurs.
 * @param {TablePageEvent} event - custom pagination event.
 * @group Emits
 */
@Output() onPage: EventEmitter<TablePageEvent> = new EventEmitter<TablePageEvent>();
/**
 * Callback to invoke when a column gets sorted.
 * @param {Object} object - sort meta.
 * @group Emits
 */
@Output() onSort: EventEmitter<{ multisortmeta: SortMeta[] } | any> = new EventEmitter<{ multisortmeta: SortMeta[] } | any>();
/**
 * Callback to invoke when data is filtered.
 * @param {TableFilterEvent} event - custom filtering event.
 * @group Emits
 */
@Output() onFilter: EventEmitter<TableFilterEvent> = new EventEmitter<TableFilterEvent>();
/**
 * Callback to invoke when paging, sorting or filtering happens in lazy mode.
 * @param {TableLazyLoadEvent} event - custom lazy loading event.
 * @group Emits
 */
@Output() onLazyLoad: EventEmitter<TableLazyLoadEvent> = new EventEmitter<TableLazyLoadEvent>();
/**
 * Callback to invoke when a row is expanded.
 * @param {TableRowExpandEvent} event - custom row expand event.
 * @group Emits
 */
@Output() onRowExpand: EventEmitter<TableRowExpandEvent> = new EventEmitter<TableRowExpandEvent>();
/**
 * Callback to invoke when a row is collapsed.
 * @param {TableRowCollapseEvent} event - custom row collapse event.
 * @group Emits
 */
@Output() onRowCollapse: EventEmitter<TableRowCollapseEvent> = new EventEmitter<TableRowCollapseEvent>();
/**
 * Callback to invoke when a row is selected with right click.
 * @param {TableContextMenuSelectEvent} event - custom context menu select event.
 * @group Emits
 */
@Output() onContextMenuSelect: EventEmitter<TableContextMenuSelectEvent> = new EventEmitter<TableContextMenuSelectEvent>();
/**
 * Callback to invoke when a column is resized.
 * @param {TableColResizeEvent} event - custom column resize event.
 * @group Emits
 */
@Output() onColResize: EventEmitter<TableColResizeEvent> = new EventEmitter<TableColResizeEvent>();
/**
 * Callback to invoke when a column is reordered.
 * @param {TableColumnReorderEvent} event - custom column reorder event.
 * @group Emits
 */
@Output() onColReorder: EventEmitter<TableColumnReorderEvent> = new EventEmitter<TableColumnReorderEvent>();
/**
 * Callback to invoke when a row is reordered.
 * @param {TableRowReorderEvent} event - custom row reorder event.
 * @group Emits
 */
@Output() onRowReorder: EventEmitter<TableRowReorderEvent> = new EventEmitter<TableRowReorderEvent>();
/**
 * Callback to invoke when a cell switches to edit mode.
 * @param {TableEditInitEvent} event - custom edit init event.
 * @group Emits
 */
@Output() onEditInit: EventEmitter<TableEditInitEvent> = new EventEmitter<TableEditInitEvent>();
/**
 * Callback to invoke when cell edit is completed.
 * @param {TableEditCompleteEvent} event - custom edit complete event.
 * @group Emits
 */
@Output() onEditComplete: EventEmitter<TableEditCompleteEvent> = new EventEmitter<TableEditCompleteEvent>();
/**
 * Callback to invoke when cell edit is cancelled with escape key.
 * @param {TableEditCancelEvent} event - custom edit cancel event.
 * @group Emits
 */
@Output() onEditCancel: EventEmitter<TableEditCancelEvent> = new EventEmitter<TableEditCancelEvent>();
/**
 * Callback to invoke when state of header checkbox changes.
 * @param {TableHeaderCheckboxToggleEvent} event - custom header checkbox event.
 * @group Emits
 */
@Output() onHeaderCheckboxToggle: EventEmitter<TableHeaderCheckboxToggleEvent> = new EventEmitter<TableHeaderCheckboxToggleEvent>();
/**
 * A function to implement custom sorting, refer to sorting section for details.
 * @param {any} any - sort meta.
 * @group Emits
 */
@Output() sortFunction: EventEmitter<any> = new EventEmitter<any>();
/**
 * Callback to invoke on pagination.
 * @param {number} number - first element.
 * @group Emits
 */
@Output() firstChange: EventEmitter<number> = new EventEmitter<number>();
/**
 * Callback to invoke on rows change.
 * @param {number} number - Row count.
 * @group Emits
 */
@Output() rowsChange: EventEmitter<number> = new EventEmitter<number>();
/**
 * Callback to invoke table state is saved.
 * @param {TableState} object - table state.
 * @group Emits
 */
@Output() onStateSave: EventEmitter<TableState> = new EventEmitter<TableState>();
/**
 * Callback to invoke table state is restored.
 * @param {TableState} object - table state.
 * @group Emits
 */
@Output() onStateRestore: EventEmitter<TableState> = new EventEmitter<TableState>();
© www.soinside.com 2019 - 2024. All rights reserved.