Entity Data Table
Experimental. The API may still change in a future release. It builds on Data Table.
Usage
Entity Data Table is a repository-backed Data Table for rows that come from an Admin SDK entity repository. Use it when you want searching, sorting, pagination, and filtering to refetch automatically, plus built-in row selection and bulk-action wiring. Define availableFilters only for the filters users actually need, and handle open-details, bulk-delete, and bulk-edit in the parent component.
import { MtEntityDataTable } from "@shopware-ag/meteor-component-library";
API reference
Props
| Prop | Type | Default |
|---|---|---|
entity * | keyof EntitySchema.Entities | |
columns * | ColumnDefinition[] | |
repository | (<EntityName extends keyof EntitySchema.Entities>(entityName: EntityName) => { search: (criteria: default, context?: ApiContext | undefined) => Promise<default<EntityName> | null>; get: (id: string, context?: ApiContext | undefined, criteria?: default | undefined) => Promise<Entity<EntityName> | null>; save: (entity: Entity<EntityName>, context?: ApiContext | undefined) => Promise<void | null>; clone: (entityId: string, contextOrBehavior?: any, behaviorOrContext?: any) => Promise<unknown>; hasChanges: (entity: Entity<EntityName>) => Promise<boolean | null>; saveAll: (entities: default<EntityName>, context?: ApiContext | undefined) => Promise<unknown>; delete: (entityId: string, context?: ApiContext | undefined) => Promise<void | null>; create: (context?: ApiContext | undefined, entityId?: string | undefined) => Promise<Entity<EntityName> | null>; }) | undefined | |
force-real-modal | boolean | |
column-changes | Record<string, ColumnChanges> | |
title | string | |
subtitle | string | |
layout | "default" | "full" | |
allow-bulk-delete | boolean | |
allow-bulk-edit | boolean | |
allow-row-selection | boolean | |
bulk-edit-more-actions | { id: string; label: string; onClick: () => void; icon?: string | undefined; type?: any; metaCopy?: string | undefined; contextualDetail?: string | undefined; }[] | undefined | |
disable-delete | boolean | |
disable-edit | boolean | |
disable-search | boolean | |
disable-settings-table | boolean | |
additional-context-buttons | { type?: "default" | "critical" | "active" | undefined; label: string; key: string; }[] | |
caption | string | |
pagination-options | number[] | |
available-filters | AvailableFilter[] |
Events
| Event | Payload |
|---|---|
open-details | [row: { id: string; }] |
bulk-delete | [rowIds: string[]] |
bulk-edit | [rowIds: string[]] |
Best practices
Do
- Let the wrapper own repository-backed table state.
- Define
availableFiltersonly for filters users actually need. - Handle
open-details,bulk-delete, andbulk-editin the parent component.
Don't
- Do not use it when the parent must fully own fetching and table state.
- Do not duplicate repository search, sort, pagination, or filter handling in the parent component.
- Do not use it for local-only datasets where plain Data Table is enough.
Behavior
- Data is fetched on mount.
- The table refetches when page, limit, sort, search, or filters change.
availableFiltersgenerates the filter UI for repository-backed filters.- Bulk actions emit the currently selected row ids.
Accessibility
- Give the table a meaningful
titleor surrounding heading. - Keep column labels and filter labels clear and specific.
Related components
- Data Table: when the parent component should own fetching and state management.