iVantage / angular-ivh-treeview

A treeview for AngularJS with filtering and checkbox support.
http://ivantage.github.io/angular-ivh-treeview/
MIT License
238 stars 89 forks source link

ivh-treeview-children-attribute does not override default config #203

Closed iandroogmans closed 7 years ago

iandroogmans commented 7 years ago

While wanting to change the children-attribute for a specific tree, i noticed my getChildren().length was always zero.

<div class="streamgroups-tree"
     ivh-treeview="$ctrl.streamgroups"
     ivh-treeview-children-attribute="'childStreamGroups'"
     ivh-treeview-on-cb-change="$ctrl.treeUpdated()">

With previous config, i received following (example) output

node.childStreamgroups.length = 3
getChildren().length = 0

When i updated the option in the ivhTreeviewOptionsProvider it worked perfectly and getChildren().length was also 3.

ivhTreeviewOptionsProvider.set({
   childrenAttribute: 'childStreamGroups'
});

Things i've tried:

jtrussell commented 7 years ago

Hmm... that's interesting. Nothing jumps out at me but I also see we don't currently have any tests for overriding this option. I'll take a look but if you were interested in submitting a PR with a failing test (and/or a fix) that would help fast track things :).

iandroogmans commented 7 years ago

Thank you for the fast reply. I will try to set up a test case a.s.a.p.

jtrussell commented 7 years ago

@iandroogmans any luck reproducing this on your end? I had a chance to take quick look but the test I threw together seems to be passing:

https://github.com/iVantage/angular-ivh-treeview/commit/0531a2ee97fa64a48ee57d94b6d928de9e834226

iandroogmans commented 7 years ago

@jtrussell Haven't had the chance to do this. I'll add it to my agenda for this weekend.

Kind regards

jtrussell commented 7 years ago

Feel free to re-open if this is still an issue :).