leocaseiro / angular-chosen

AngularJS Chosen directive is an AngularJS Directive that brings the Chosen jQuery in a AngularJS way
http://leocaseiro.github.io/angular-chosen/
MIT License
682 stars 248 forks source link

pls add feature for tree selector #252

Closed xycloud closed 6 years ago

xycloud commented 6 years ago

add feature for tree selector, for example

item1 ├── item11.cfg ├── item12.db ├── item13    └── item131

leocaseiro commented 6 years ago

Hi @xycloud,

Thank you for opening this issue.

You are able to add nested/tree values with the group which converts to an optgroup, the same way you'd do with a normal ng-select and <select>.

$scope.teams = {
  "teams": [
    {"name": "Johan", "email": "johan@mail.com", "group": "one"},
    {"name": "Mala", "email": "mala@mail.com", "group": "two"},
    {"name": "Saimin", "email": "saimin@mail.com", "group": "one"},
    {"name": "Dolah", "email": "doll@mail.com", "group": "three"},
    {"name": "Abah", "email": "abah@mail.com", "group": "three"}
  ]
}

See http://plnkr.co/edit/j0yIif?p=preview

Related to #47 #113

xycloud commented 6 years ago

hi @leocaseiro ,

Thank you for your quick answer and online demo.

but could the tree selector has two three and with collapse feature? the demo you provided only has two depth.

leocaseiro commented 6 years ago

Hi @xycloud,

I understand you need more than 2 nested in your tree, but unfortunately, it's beyond the scope of this project which uses Chosen with Angular. Chosen is an enhancement to the html select tag and they follow the W3C recommendations.

I suggest you try another component such as http://ivantage.github.io/angular-ivh-treeview/ for your needs.

xycloud commented 6 years ago

yes, awesome compo, thank you very much @leocaseiro