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: v-model:editingRows is not reactive when changed from outside #4337

Closed
NikoGJ opened this issue Aug 28, 2023 · 0 comments · Fixed by #4343
Closed

DataTable: v-model:editingRows is not reactive when changed from outside #4337

NikoGJ opened this issue Aug 28, 2023 · 0 comments · Fixed by #4343
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@NikoGJ
Copy link
Contributor

NikoGJ commented Aug 28, 2023

Describe the bug

When changed programmatically, the editingRows prop is not reactive, we need an extra step to have the DataTable reflect the changes.

See repro sandbox below.

Reproducer

https://codesandbox.io/p/sandbox/primevue-demo-forked-ms5vl4?file=/src/App.vue:12,9

PrimeVue version

3.32.0

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Click on the "Edit row" button. This adds the first row in editing mode by pushing the row in the editingRows array.
  2. Notice nothing happened.
  3. Click on the pencil edit button of any other row in the table. This will refresh the component.
  4. Notice now that 2 rows are in edit mode: The one that was just added with the pencil edit button, and the first one which was added through the "Edit row" button.

Workaround:
We can force the DataTable to update itself using $forceUpdate (check the "Edit row with forceUpdate" button) or using the :key trick, but it is generally discouraged to do so, and it's usually preferable to let Vue's core reactivity do the job.

Expected behavior

The DataTable should reflect the changes made to v-model:editingRows when editingRows are changed from outside the component (i.e. programmatically)

@NikoGJ NikoGJ added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 28, 2023
NikoGJ added a commit to NikoGJ/primevue that referenced this issue Aug 28, 2023
NikoGJ added a commit to NikoGJ/primevue that referenced this issue Aug 29, 2023
@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working Component: Accessibility Issue or pull request is related to WCAG or ARIA and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Component: Accessibility Issue or pull request is related to WCAG or ARIA labels Sep 1, 2023
@tugcekucukoglu tugcekucukoglu added this to the 3.33.0 milestone Sep 1, 2023
tugcekucukoglu added a commit that referenced this issue Sep 1, 2023
Fixed #4337 - DataTable: editingRows is not reactive
mertsincan pushed a commit that referenced this issue Sep 5, 2023
…t space character (#4333)

* Fixed #4120 - DataTable: Selection and Row/Cell editing : Cannot input space character

* Fixed #4337 - DataTable: editingRows is not reactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants