p-pickList #262
-
I am using the component
When the page loads everything is fine once the data is saved in the database and retrieved for editing, we populate the [target]="assignedRolesList" variable but the [source]="roleList" is not updated
thank you so much |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi, Could you please create a stackblitz example so we can identify the issue precisely? It's related to change detection but we need an example to try possible workarounds without diving into the source code. |
Beta Was this translation helpful? Give feedback.
-
Maybe this would help, created an example with to simulate request-response https://stackblitz.com/edit/fnkj9d?file=src%2Fapp%2Fdemo%2Fpicklist-filter-demo.ts,src%2Fapp%2Fdemo%2Fpicklist-filter-demo.html |
Beta Was this translation helpful? Give feedback.
-
It is understood, in the case that in the loadData, there is the initial data with which the source will always be loaded and the idea is that when bringing the data from the database and assigning it to the target, the source must update with the differences with the target The solution I gave is this
roleList = source |
Beta Was this translation helpful? Give feedback.
Hi,
The problem is change detection, you're copying the array and you need to modify it to trigger change detection or you can manually trigger change detection. See the example below
https://stackblitz.com/edit/fnkj9d-xbdeu1?file=src%2Fapp%2Fdemo%2Fpicklist-filter-demo.ts