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

DataTable: Values of frozen row's cells are duplicated on first non-frozen row #7569

Open
Quentin-L21 opened this issue Jan 6, 2025 · 1 comment
Labels
Type: Bug Issue contains a defect related to a specific component.

Comments

@Quentin-L21
Copy link

Describe the bug

When using the DataTable component with editMode="cell", having an editable frozen row and multiple editable non-frozen rows causes the value from the frozen row to be copied to the first non-frozen row.

Reproducer

https://stackblitz.com/edit/as8ypzgp-y2bs8hf4?file=src%2FApp.tsx

System Information

primereact: ^10.8.5;
react: ^18.3.1

Steps to reproduce the behavior

I need to have a frozen row (using the frozenValue property) and multiple non-frozen rows (using the value property).

Both the frozen row and the sub-rows need to be editable (in the provided example, all cells are editable).

Here is how to reproduce the bug:

  1. Click on the Name Column of the frozen row (Do not modify the value !)
    image

  2. Click directly to the Name column of the first non-frozen row

  3. The value of the frozen row is now in the non-frozen row :
    image

Do not hesitate to tell me if this is a problem on my implementation !

Thanks a lot !

Expected behavior

The value of the frozen row should not be copied to the first non-frozen row

@Quentin-L21 Quentin-L21 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 6, 2025
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 6, 2025
@tneeraja95
Copy link
Contributor

This issue is happening because while rendering, frozen rows and normal rows are rendered differently but while editing it in onEditingMetaChange, the state editingMetaState is mixing the two.

One solution can be to maintain a different editingMetaState for frozen rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants