Duplicate Parent Categories Appearing in Hierarchy View

0
We need to build a feature where Mastercategories are shown in a table with hierarchy, so Category 1 entries are grouped under their Category 0. From this datagrid2, we should be able to select or deselect categories and save them, so only the chosen ones are used in the project. Once saved, these become Projectcategories. The expected structure should look like this: Parent 1               Child 1                 Child 2   Parent 2                  Child 3   But right now, the system is creating duplicates. The same Parent 1 with its children is being shown again at the bottom, like this Parent 1               Child 1                 Child 2   Parent 2                  Child 3   Parent 1               Child 1                 Child 2   here the parent 1 is repeated 2 times because in datagrid2 i had selected2 elements(children) of same parent (parent1).  
asked
1 answers
0

I believe the List that is used for selection and the list that in the bottom with duplicates are 2 separate lists

 

Are you check if Parent 1 is already added. and only add if it is not added. By default List Allows Duplicates, so it is your responsibility to check and verify if the element is already present or not before adding

 

you can do a Find by Expression on the bottom List and check if Parent 1 already exists. if not then add it and refresh in client. so it wont be duplicated

answered