Creating a Reusable Table System with AG Grid: Patterns for Enterprise Applications
27 April 2025

Tables are a fundamental component in any admin interface. They need to display data efficiently, handle sorting and filtering, and provide a consistent user experience. In this article, I’ll share patterns I’ve developed for building a reusable table system using AG Grid that standardizes tables across an enterprise application while remaining flexible for different use cases.
The Table Challenge
When I started working on a large-scale admin dashboard, I found myself creating many similar table implementations across different features. This led to several issues:
- Inconsistent styling and behavior between tables
- Duplicate code for common functionality
- No standardized approach to empty states
- Different patterns for handling row clicks
- Repetitive filtering implementation
To solve these problems, I created a reusable table system based on AG Grid.
The EntityTablePage Component
The heart of the system is an EntityTablePage component that accepts generic typed data:
This component takes a variety of props to customize the table while maintaining consistent patterns.
Key Features of the Reusable Table System
1. Consistent Header with Search
Each table includes a standardized header with search functionality:
2. Flexible Empty States
The component handles empty states with a consistent pattern:
This allows for:
- The default empty state with “Add New” action
- Custom empty state component
- Configurable action behaviour
4. Row Navigation
The component implements a standardized pattern for row navigation:
This allows for:
- Default behavior of navigating to entity detail page
- Custom click handlers
- Special handling for action columns
5. Dynamic Filtering
The component implements dynamic filtering:
This pattern:
- Memoizes filter results to improve performance
- Supports custom filter functions
- Handles text-based filtering
Column Factory Pattern
One of the most powerful patterns I discovered was a column factory system that creates standardised column definitions:
These factory functions return standardized column configurations:
This pattern:
- Creates reusable column definitions with consistent styling
- Provides type safety through generics
- Supports customization through options
- Handles complex rendering scenarios like icons and dates
- Normalizes common patterns across different entity tables
Action Column Pattern
For actions, I implemented a dedicated pattern that ensures consistent user interactions:
This approach:
- Pins action menus to the right for consistency
- Uses a standardized constant for the column ID
- Provides a consistent visual treatment
- Allows for dynamic menu items based on the row data
- Handles click events consistently across tables
Type-Safe Column Definitions
The column definitions are fully type-safe:
This pattern:
- Ensures column definitions match the data type
- Allows for extending types with UI-specific fields (e.g.,
referenceCount) - Provides IDE autocomplete for field names
- Catches type errors at compile time
Usage Example
A typical implementation of the table looks like:
Why This Pattern Works
This table system offers several advantages:
- Consistency: All tables follow the same patterns and styling
- DRY Code: Common functionality is abstracted away
- Type Safety: Generic typing ensures type safety across the table
- Developer Experience: Implementing new tables is simple and fast
- User Experience: Users get consistent behavior across the application
- Maintainability: Column definitions are separated from rendering logic
- Reusability: Factory functions create consistent columns across tables
- Extensibility: The pattern supports special cases while maintaining standards
Conclusion
To implement a similar pattern in your own projects:
- Create a base table component with generic typing
- Standardize headers, empty states, and row interactions
- Implement consistent filtering mechanisms
- Create a column definition factory pattern
- Use custom cell renderers for specific presentation needs
- Ensure type safety with generic column definitions
- Standardize action columns and their behavior
This approach creates a more maintainable and consistent table system that improves both developer experience and end-user experience. By centralizing common patterns, you can focus on the unique aspects of each table rather than reimplementing the same functionality.
What table patterns have you found effective in your React applications? I’d love to hear about your experiences in the comments.
Connect and Grow Together
Want to dive deeper into software engineering and bulletproof pattern-based approaches? Let’s connect:
Professional Networking
— LinkedIn: For in-depth tech discussions and professional insights.
— Twitter/X: Quick tips, tech trends, and software engineering snippets.
Work With Me
Hire me as a full-stack engineer for any software engineering projects (ranging from Frontend, Backend, Mobile, Cloud and anything else in between).
— My Portfolio
Stay Updated
Follow along for more technical deep dives, coding tutorials, and software engineering strategies. Let’s keep learning and growing together!
Also published on Medium.