-
Notifications
You must be signed in to change notification settings - Fork 6
Migrate Grid Lite samples to v0.4.0 declarative column API with function components #1028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: vnext
Are you sure you want to change the base?
Conversation
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I don't like the use of gridRef to access columns to assign templates. It should work just fine to assign those directly to the column component.
<igc-grid-lite-column field="price" cellTemplate={priceCellTemplate}></igc-grid-lite-column>
Can you update the those to simple functions for all samples. Also while at it, switch the sample components to function-based please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! All 13 samples have been refactored to:
- Function-based components using React hooks (useState, useEffect, useCallback, useMemo)
- cellTemplate functions defined outside component and passed directly as props
- Removed all gridRef.current.columns.find() pattern for setting templates
See commits 5dfbd91, 5358ef6, and 46f2710 for the complete refactoring.
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
…d fix useMemo dependencies Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
Updates all 13 Grid Lite samples to use the declarative column configuration API introduced in
igniteui-grid-litev0.4.0. Columns are now defined as JSX elements instead of programmatic arrays, and all samples have been refactored to modern function-based React components.Changes
Package updates
igniteui-grid-liteto~0.4.0in all samplepackage.jsonfilesColumn configuration
<igc-grid-lite-column>JSX elementskey→field,type→dataType,headerText→headersort: true→sortable,filter: true→filterablecellTemplatedirectly as props to column elements (defined as functions outside components)Component architecture
useState,useEffect,useCallback,useMemo,useRefuseEffectreturn functionsGrid-level sorting API
sortConfiguration→sortingOptionssortConfiguration.multiplewithsortingOptions.mode('single' | 'multiple')sortExpressions→sortingExpressionson grid instancestriStatepropertyEvent handlers and expressions
keyproperty inFilterExpressionandSortingExpressionobjects (refers to field name, not column property)Example
Before (class-based with gridRef access):
After (function-based with direct cellTemplate props):
Impact: Net -296 lines across 25 files (1,398 insertions, 1,694 deletions) with improved code quality and maintainability
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.