khan4019 / tree-grid-directive

Need one or more maintainer for this! comment or email me if you are interested
http://khan4019.github.io/tree-grid-directive/test/treeGrid.html
347 stars 183 forks source link

Problem with ng repeat #153

Closed reem80 closed 6 years ago

reem80 commented 6 years ago

Hello together,

I m new to JS and angular and I m using your tree in a frontend where I fill the tree using a rest call. If I clicked back in my browser and start to fill the tree again I get

Error: ngRepeat:dupes Duplicate Key in Repeater

do you have any idee how to solve this? Did anyone face the same issue? Thanks and regards. Reem.

Shai1436 commented 6 years ago

Hi Reem, The Duplicate Key error happens when you have duplicate entries with same "DemographicId" in outermost level. It is probably happening because at every reload you are triggering the API and filling the already populated tree. You can check before calling the API, if tree is empty or you can exclusively empty the tree before filling it. Interestingly, you don't get this error, if you have duplicate children.

reem80 commented 6 years ago

Hi Shahrukh,

thanks for the answer. The problem is solved. I had to clear the children nodes before reinserting again.