Fix rowClass
Type Definition in DataTable
#5414
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request addresses an issue with the
DataTable
component'srowClass
property type definition. Previously, the type was incorrectly defined as[String, Object]
, which does not accurately reflect the intended usage and functionality. This fix updates the type definition to[Function]
, aligning with the component's capability to accept a function for dynamically assigning classes to rows based on their data.Related Issues
These issues highlight the confusion and type errors encountered by developers due to the incorrect type definition. This PR aims to resolve these concerns by correcting the
rowClass
type.Technical Details
The
rowClass
property's type definition has been updated in the component's PropType definition, ensuring that TypeScript users will receive accurate type checking and autocompletion support when using theDataTable
component.Impact
This change is a defect fix and does not introduce any breaking changes. It improves developer experience by ensuring the component's API is correctly typed, allowing for the advanced customization of row styling based on row data.
How to Test
DataTable
implementation where therowClass
property is used.rowClass
function that returns a class name based on the row data.Changes Made
rowClass
property from[String, Object]
to[Function]
in theDataTable
component.Defect Fixes
This PR is submitted in response to issues #5341 and #5349. It corrects the type definition for the
rowClass
property, addressing the reported problem and improving the component's usability and type safety.