Update multiple selection on a treetable issue

UI Components for Angular
Post Reply
JulienSeam
Posts: 1
Joined: 09 Nov 2022, 13:32

09 Nov 2022, 14:37

Hi,
I am using the PrimeNG p-treeTable with multiselection.
My selection is based on a TreeNode[] observable where I just put the Ids of the nodes that should be selected.
It most of the time works pretty well, although I have a corner case where it doesn't work properly.
In my onNodeSelect handler instead of just added or removing the selected id from my TreeNode array I have a sanitize function.
One exemple is : [ {data : {id:1}}] as original selected nodes, then I select a node (id 5) and the selected nodes comes as : [ {data: {id: 7}, {data: {id: 8}, {data: {id: 9}].
In such a case it only displays node 1 and 5 as selected on the tree table.
If I refresh the page, and then the selection is initialized through the TreeNode (which is having the correct data on load thanks to url) it displays it properly.
So it seems that when doing a selection if the TreeNode holding the selection has more than one item changing it will not be reflected in the tree table.
It tried a little workaround : I used a *NgIf to hide then show the table in such a case and it does work, displaying the selected items properly. Although I cannot go with this selection because the screen "blinks" which is nit acceptable and it gives me some other side effect.
Any ideas how to deal with that ?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest