p-table not updating selected items after data change

UI Components for Angular
Post Reply
kwebster
Posts: 4
Joined: 11 Jul 2019, 17:25

15 Apr 2021, 05:20

Wondering if anyone has ever run into this issue. I'm going to try to duplicate the issue with a basic app in the morning I think but figured I'd post it here as well.

So if you have a table with the selection bound like so:

Code: Select all

<p-table [columns]="cols" [value]="data" selectionMode="multiple" [(selection)]="selectedItems">
Then you select one or more items. While selected, the data value changes and one of the items in your selection is removed - what I'm currently seeing is that the removed item stays in the selectedItems in spite of it no longer appearing in the table.

PhilHuhn
Posts: 93
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

23 Apr 2021, 13:37

Hey, I am just a fellow user, but this may be a bug request. Try on GitHub...

https://github.com/primefaces/primeng

Then go to the issues tab. I am not sure what PrimeFaces thinks the supported use-cases for turbo-table, but you should give them a chance to understand your issue. I have personally reported bugs there.

Now per remediation of your issue, in your table row delete method you can add something like the following:

Code: Select all

this.selectedItems = this.selectedItems.filter( item => item.Id !== deleteId );

Good luck.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests