oro-datagrid
OroCommerce v6.1 Datagrid Configuration & Customization
Core File Location
Datagrids live in Resources/config/oro/datagrids.yml within your bundle. Bundle auto-discovery loads these on kernel compilation.
Grid Structure (v6.1 Canonical Example)
datagrids:
my_grid:
source:
type: orm
query:
select: [d]
from: [{ table: Acme\Bundle\DemoBundle\Entity\Document, alias: d }]
columns:
id:
label: ID
subject:
label: Subject
filters:
columns:
subject:
type: string
data_name: d.subject
sorters:
columns:
id:
data_name: d.id
default:
id: DESC
actions:
view:
type: navigate
label: View
icon: eye
link: acme_demo_document_view
rowAction: true
Every grid needs: source (ORM query), columns (display), filters (with data_name), sorters (with data_name), and actions.
Column Types
Most common: string, integer, boolean, datetime, currency (requires currency_code option). See references/column-types.md for the full list.
Extending Existing Grids
Never modify core grid YAMLs. Use a BuildBefore event listener to add columns, filters, or modify config programmatically. For related entity data, use onResultAfter to attach data post-fetch instead of adding JOINs.
See references/datagrid-patterns.md for full listener examples (onBuildBefore, onResultAfter), service registration, join patterns, mass actions, and inline editing configuration.
Key Pitfalls
- Column
data_namemismatch — If sorters/filters usedata_name: d.subjectbut the query doesn't have aliasd, sorting fails silently. Always verify alias consistency. - Filter without
data_name— Renders in the UI but produces no WHERE clause. Users see the filter but it does nothing. - ACL on grid actions is separate from entity ACL — Both
acl_resourceon mass_actions AND entity-level ACL must pass. Define the resource inacl.yml.
Cache
Datagrids are compiled into the DIC. After YAML changes: php bin/console cache:clear.
See Also
references/column-types.md— Full column & filter type referencereferences/datagrid-patterns.md— Inline editing, mass actions, listener examples, join patterns, additional pitfallsreferences/v6.1.md— v6.1 specifics, backward compatibility, and troubleshootingreferences/v7.0.md— v7.0 changes (placeholder)