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

Edit and Sort combination support for Table #508

Closed
mr83-uw opened this issue Sep 28, 2020 · 3 comments
Closed

Edit and Sort combination support for Table #508

mr83-uw opened this issue Sep 28, 2020 · 3 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@mr83-uw
Copy link

mr83-uw commented Sep 28, 2020

I'm submitting a ...

[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Similar to this bug in primereact: primefaces/primereact#878

When I add a sort field to the Demo on this page: https://primefaces.org/primevue/showcase/#/datatable/edit

When editing a cell, the datatable will change the sort of the table, and cause you to edit unintended cells. The expected behavior would be to not resort the table until the editing is completed.

Also is it possible to have a reactiveSort flag on the table, that will only resort the table when clicking on the column headers? Any new entrys in the data should default to the end of the list.

@cagataycivici
Copy link
Member

Sort and Cell edit combination is not supported now, we'll review it after 3.0 final.

@mertsincan Also happens to React and probably NG so let's discuss this.

@cagataycivici cagataycivici changed the title DataTable Edit Sort Causes change of focus and editing of wrong cells Edit and Sort combination support for Table Oct 10, 2020
@cagataycivici cagataycivici added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Oct 10, 2020
@subodhkalika
Copy link

+1

@mertsincan
Copy link
Member

mertsincan commented May 16, 2021

Hi,

Fixed for PrimeReact and PrimeVue. The DataTable component never stores the user's data. Therefore, in any state change, the sort and filter events are called again. That's why I added a callback called @value-change to send the data that changes during these events to the user. With this callback, you can sync the calculated data with the data you give to the DataTable. Exp;

<DataTable :value="products" editMode="cell" @value-change="onValueChange($event)">
   ...
</DataTable>
...

onValueChange(value) {
    this.products = value;
}

Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

4 participants