Skip to content
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

Fix rowClass Type Definition in DataTable #5414

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

shtse8
Copy link
Contributor

@shtse8 shtse8 commented Mar 14, 2024

Summary

This pull request addresses an issue with the DataTable component's rowClass 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 the DataTable 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

  1. Pull the changes from this branch.
  2. Navigate to a DataTable implementation where the rowClass property is used.
  3. Define a rowClass function that returns a class name based on the row data.
  4. Ensure TypeScript does not raise any type errors, and the returned class names are correctly applied to the rows.

Changes Made

  • Updated the type definition of the rowClass property from [String, Object] to [Function] in the DataTable 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.

Copy link

vercel bot commented Mar 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Mar 14, 2024 10:29am

@tugcekucukoglu tugcekucukoglu merged commit 8ef3971 into primefaces:master Mar 14, 2024
2 of 3 checks passed
@bwhitt
Copy link

bwhitt commented Mar 22, 2024

Thanks for working on this. I want to report i am now seeing a different error from vue-tsc. No longer getting the Vue warn in the console.

The functionality still works, in that the row class is being applied. Just a typescript thing.

image

setRowClass
image

image

Types
image
image

Should i make a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants