tree-grid-directive icon indicating copy to clipboard operation
tree-grid-directive copied to clipboard

Allow tree expanded by default and let free users to expand/collapse rows

Open Lilipi opened this issue 7 years ago • 4 comments

#53

  • In your controller, just before pushing your data into your tree do this :
response.init = true;
response.expandAll = true;
$scope.tree_data = response;
  • In your controller, add this $on :
$rootScope.$on("expandedInit", function() {
	$scope.tree_data.init = false;
})

Hope this helps !

Lilipi avatar Jan 11 '18 14:01 Lilipi

Hello Lilipi , thanska lot. It helped me to solve my problem. I have another question regarding ng repeat in the template. When I try to load my tree again, it gives me an error Error: ngRepeat:dupes Duplicate Key in Repeater

do you have any idee how to solve this? Thanks and regards. Reem.

reem80 avatar Jan 24 '18 13:01 reem80

Hello reem80,

You said you "load your tree again", does it mean that you update your data in it ? Are your sure you haven't duplicate data in your tree ? (rows that have the same key) Do you clear your tree's data before loading it again ?

Have a good day !

Lilipi avatar Jan 25 '18 08:01 Lilipi

Hello Lilipi,

I m sure that my data is not duplicated. The problem occures when I use track by row.branch.uid. When I change to track by $index the data is loaded in my tree but duplicated. Is there any way to clean my ng-repeat? I do also tree_data.length=0 before inserting again. Thanks a lot for your help.

Regards. Reem.

reem80 avatar Jan 25 '18 08:01 reem80

Hello reem80, It seems that you're data are really duplicated if you see it duplicated in your tree. So it's normal that your ng-repeat doesn't work on uid (duplicated) whereas it works with $index (unique for each row).

Did you try tree_data = [] before inserting again ? Are you sure your treatment doesn't return duplicated data ?

Emilie

Lilipi avatar Jan 29 '18 11:01 Lilipi