Git Product home page Git Product logo

Comments (5)

mlvn23 avatar mlvn23 commented on July 18, 2024

Look at the Example of Hierarchical Data section in Select2 documentation. You need to use children. Unfortunately, it looks like this directive doesn't handle that (select2 will display and return the data, but something in the optionItems lookup didn't take care of the children case). Trying to hack it right now.

from angular-select2.

mlvn23 avatar mlvn23 commented on July 18, 2024

It looks there's two options: a) recursively collect the IDs if an entry has children (select2 apparent supports multi-levels not just 2), or b) skip the optionItems altogether. I got the first option to work but not the second. Do we really need the indirection provided by optionItems? If it's just a key data type conversion thing, maybe we could just drop it altogether. It seems very inefficient to recursively do this ID collection for every query.

from angular-select2.

rubenv avatar rubenv commented on July 18, 2024

If it's just a key data type conversion thing, maybe we could just drop it altogether.

It's exactly that, but it's very important for where it's currently being used. Correctly setting integer keys on the model when integer keys were passed in matters a lot.

We can't drop that.

from angular-select2.

rzmz avatar rzmz commented on July 18, 2024

Hi, I got it working in some degree (using children):
https://github.com/rzmz/angular-select2/commit/25ad952835c8d1ef7e89b353399e0b835660d98f
Only thing that bothers me is that clicking on an opt group does not select group but closes the dropdown. Should leave it as is and not respond to user click in any way (if there is no id provided with the element)
I can create a pull request if you think this is something to go with.

from angular-select2.

piernik avatar piernik commented on July 18, 2024

Any news on this? Grouping doesn't work:/

from angular-select2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.