Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngOptions: non-grouped options shouldn't float to the top when using group by #10531

Closed
tdakhla opened this issue Dec 19, 2014 · 3 comments
Closed

Comments

@tdakhla
Copy link

tdakhla commented Dec 19, 2014

Example fiddle where non-grouped options incorrectly always float to the top: http://jsfiddle.net/raxzauyL/ (against 1.3.7)

The expected behavior is that the options should be interspersed between the optgroups, not bunched at the top. I've tried setting the group by value to '', undefined, null, and even removing the key from the obj completely, but none seem to work.

@pkozlowski-opensource
Copy link
Member

@tdakhla not sure why you saying that

The expected behavior is that the options should be interspersed between the optgroups

IMO the current behaviour has much more sense - you are telling a select box to group items and this is exactly what it does. The micro-syntax doesn't support mixing regular options and optiongroups and honestly I can't think of a variation of it that would support your use-case.

Now, I guess this issue boils down to making sure <select> can be used without micro-syntax (that is, with options / optiongroups generated by users based on the model value).

@tdakhla
Copy link
Author

tdakhla commented Dec 21, 2014

@pkozlowski-opensource I believe that the expected behavior is the non-grouped items displayed in the dropdown respect array ordering as much as possible, even when using group by. It's definitely possible to have an array with out of order grouped items (http://jsfiddle.net/wv4swhpn/), and the resulting behavior is fine in this case (first occurrence of a grouped item is where all the grouped items will live), but.. the non-grouped items get put at the top. Given current state behavior, that is definitely a discrepancy as I would expect non-grouped items to be bunched where the first non-grouped item lives. However, since I don't believe that non-grouped items are in any way related to each other, they shouldn't be bunched at the top, or even where the first non-grouped item lives - they should remain where they are in the list.

@petebacondarwin
Copy link
Contributor

This is fixed by #10639

See http://jsfiddle.net/su61n9m9/

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants