The ObjectAgGrid component is already installed as part of the @object-ui/plugin-aggrid package.
import { ObjectStackAdapter } from '@object-ui/data-objectstack';
import '@object-ui/plugin-aggrid'; // Auto-registers the componentconst dataSource = new ObjectStackAdapter({
baseUrl: 'https://your-api.example.com',
token: 'your-auth-token' // Optional
});const gridSchema = {
type: 'object-aggrid',
objectName: 'contacts', // The object to fetch from your backend
dataSource: dataSource,
pagination: true,
pageSize: 20,
theme: 'quartz',
height: 600
};import { SchemaRenderer } from '@object-ui/components';
function MyComponent() {
return (
<div>
<h1>My Contacts</h1>
<SchemaRenderer schema={gridSchema} />
</div>
);
}const schema = {
type: 'object-aggrid',
objectName: 'contacts',
dataSource: dataSource,
fieldNames: ['name', 'email', 'phone', 'company'], // Only show these
pagination: true
};const schema = {
type: 'object-aggrid',
objectName: 'tasks',
dataSource: dataSource,
editable: true,
singleClickEdit: true, // Single-click to edit
callbacks: {
onCellValueChanged: (event) => {
console.log('Updated:', event.data);
// Changes are automatically saved to backend!
}
}
};const schema = {
type: 'object-aggrid',
objectName: 'products',
dataSource: dataSource,
filters: {
category: 'Electronics',
price: { $lt: 1000 }
},
sort: {
price: 'asc'
}
};const schema = {
type: 'object-aggrid',
objectName: 'sales',
dataSource: dataSource,
exportConfig: {
enabled: true,
fileName: 'sales-report.csv'
}
};When you use ObjectAgGrid, it automatically:
- ✅ Fetches the object schema (field definitions) from your backend
- ✅ Generates appropriate column definitions based on field types
- ✅ Applies proper formatters (currency, dates, percentages, etc.)
- ✅ Loads data with pagination
- ✅ Saves edits back to the backend (when
editable: true)
- Currency:
$1,234.56 - Percent:
45.5% - Date: Localized date format
- Boolean: ✓ Yes / ✗ No
- Email: Clickable mailto links
- Phone: Clickable tel links
- URL: Clickable external links
- Color: Color swatches
- Rating: Star ratings ⭐⭐⭐⭐⭐
- And 20+ more field types!
Your ObjectStack backend should provide:
-
Metadata Endpoint: Returns object schema with field definitions
GET /api/v1/metadata/object/{objectName}
-
Data Endpoint: Returns paginated data
GET /api/data/{objectName}?$top=20&$skip=0
-
Update Endpoint (for editable grids):
PATCH /api/data/{objectName}/{id}
- See
OBJECT_AGGRID_CN.mdfor Chinese documentation - See
examples/object-aggrid-demo.tsxfor complete examples - See
README.mdfor full API reference
Data not loading?
- Check that your
dataSourceis properly initialized - Verify the
objectNameexists in your backend - Check browser console for errors
Columns not showing?
- Verify your object schema has field definitions
- Check that fields have
nameandtypeproperties
Editing not working?
- Make sure
editable: trueis set - Verify fields are not marked as
readonly - Check that your backend update endpoint is working
For issues or questions, please refer to:
- Full documentation in
README.md - Chinese documentation in
OBJECT_AGGRID_CN.md - Implementation details in
IMPLEMENTATION_SUMMARY.md