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

When saving row in a Datatable using editMode=row => source entity is mutated #7375

Open
lucasdavidferrero opened this issue Mar 5, 2025 · 1 comment
Labels
Resolution: Cannot Replicate Issue could not be replicated by Core Team

Comments

@lucasdavidferrero
Copy link

Original entity is mutated when using editMode=row in Datatable component.

example:

const products = ref([]);
const editingRows = ref([]);

function onRowEditSave(event: DataTableRowEditSaveEvent) {
  console.log(event.data) // "before update data"
  console.log(event.newData) // "after update data"
}

event.data is already updated with the information that was saved by clicking the check icon. Even worse, event.data points to the corresponding entity in products (original source).

event.newData has the updated information. So, event.data and event.newData both holds the updated information.

I think this is a really big issue. What if i want to apply some validation rules before updating the entity's original source?

template code:

<DataTable :value="products" v-model:editingRows="editingRows"
                     size="small"
                     dataKey="id" :lazy="true" scrollable
                     :rows="rowsPerPage" :total-records="totalItems" editMode="row"
                     @row-edit-save="onRowEditSave">
...
</DataTable>
@lucasdavidferrero lucasdavidferrero changed the title When saving row in a Datatable using editMode=row source entity is mutated When saving row in a Datatable using editMode=row => source entity is mutated Mar 5, 2025
@tugcekucukoglu tugcekucukoglu added the Resolution: Cannot Replicate Issue could not be replicated by Core Team label Mar 7, 2025
Copy link

github-actions bot commented Mar 7, 2025

We're unable to replicate your issue, if you are able to create a reproducer by using PrimeVue Issue Template or add details please edit this issue. This issue will be closed if no activities in 20 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Cannot Replicate Issue could not be replicated by Core Team
Projects
None yet
Development

No branches or pull requests

2 participants