TCB Table Component
The CmsTableComponent is a powerful Angular component designed to work with the CMS CRUD package. It provides functionality for displaying tabular data with support for custom templates, actions, sorting, and integration with a data service (CmsService<T>). It also supports dynamic configuration and event handling for row and cell actions.
How to use the component in your app :
import the component :
import {CmsTableComponent} from '@tradinos/cms-frontend-entity';2. selector for component , like it :
<lib-cms-table>
</lib-cms-table>Features
Dynamic Templates: Custom templates for cells and rows can be injected using the
templatesinput.Event Emitters: Handles sorting, row actions, and cell actions via dedicated methods.
Integration with CmsService: Automatically fetches and updates data, providing a seamless CRUD experience.
Action Visibility: Dynamically calculates and displays actions based on data and configuration.
Inputs
Input
Type
Description
Required
templates
{ [key: string]: TemplateRef<any> }
A dictionary of custom templates for rendering specific parts of the table.
Yes
emptyDataTemplate
TemplateRef<any>
Custom template to display when no data is available.
No
CmsTableComponent
The CmsTableComponent is a powerful Angular component designed to work with the CMS CRUD package. It provides functionality for displaying tabular data with support for custom templates, actions, sorting, and integration with a data service (CmsService<T>). It also supports dynamic configuration and event handling for row and cell actions.
Features
Dynamic Data Handling:
Listens to updates from the
CmsServiceand dynamically adjusts the table's content and actions.
Customizable Templates:
Allows injecting custom templates for cells, rows, or headers using the
templatesinput.
Action Visibility:
Dynamically determines and toggles the visibility of actions based on the data.
Sorting:
Handles sorting logic for columns and integrates with server-side or client-side sorting mechanisms.
Action Events:
Emits events for both row-level and cell-level actions, enabling interaction handling.
Inputs
Input
Type
Description
Required
Default Value
templates
{ [key: string]: TemplateRef<any> }
A dictionary of custom templates for rendering specific parts of the table.
No
{}
emptyDataTemplate
TemplateRef<any>
Custom template to display when no data is available.
No
Methods
customSort(event: SortEvent): void
Description: Handles sorting logic for table columns and updates the filter configuration in the
CmsService.Parameters:
event: Contains sorting information (fieldandorder).
Example
emitCellAction(key: string, item: T): voidDescription: Emits a cell-specific action event via the
CmsService.Parameters:
key: Identifier for the action (e.g., "edit" or "delete").item: The data row associated with the action.
Example
emitRowAction(key: any, item: T): voidDescription: Emits a row-specific action event via the
CmsService.Parameters:
key: Identifier for the action (e.g., "view" or "delete").item: The data row associated with the action.
Example
Last updated