-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Proposal: adding static choices #152
Comments
@ProLoser what do you think on this? |
It'd be really nice to specify if the ui-select-static-choice could appear above or below the search box, or tied to the bottom of the popup. |
@arkarkark maybe we could have a something like this: <ui-select-static-choice anchor='bottom'>
<button ng-click="openCreateNewWindow()">Create New</button>
</ui-select-choices-static> |
I don't know why, or exactly how the logic works now, but I sort of imagined something way less complicated: <ui-select ...>
...
<!-- this doesn't have to be ul+li, could be whatever DOM you wanted -->
<ul ui-select-choices ...>
<li ng-click="...">Static 1</li>
<li ng-click="...">Static 2</li>
<li ng-click="..." ng-repeat="...">...</li>
<li ng-click="...">Static 3</li>
</ul>
</ui-select> I realize this may not be feasible based on the current design but this is essentially what I think about when I imagine static options mixed with virtual options. I am not a huge fan of creating more directives/attributes/options just for weird edgecases vs just making the level of control when templating much more powerful. |
@ProLoser I agree that more directives isn't something that I like neither. I'm only worried that if we change the functionality of Other alternative could be to leave the current implementation as a shortcut way (like other shortcuts proposed on #106) and if user needs more flexibility, then they can use this other syntax with a child |
@dimirc I like your anchor="" choice. I see three options above_search once position: sticky is more supported, perhaps having those interleaved with the options would be really nice. while I'm wishing for a pony, having the static option scroll off when you scroll up (for position below_search or bottom), but then appear right away if you scroll down a bit (like the chrome url bar in android chrome (I think it's called quick return (like in this video: https://youtu.be/Qf8BgjfV3WU)) |
Sorry but that exact level of convolution is what I would prefer to avoid. |
@arkarkark @ProLoser
Basically we can still work the same way we are right now BUT if the user needs more flexibility then just add the repeat on a child element, to make it clear, these will be both valid: Valid way 1 <ui-select ng-model="person.selected">
<ui-select-match placeholder="Select a person...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="person in people | filter:$select.search">
{{person.name}}
</ui-select-choices>
</ui-select> Keeping support for this alternative, we have a smaller syntax on simple cases and also avoid introducing a breaking change. Valid way 2 <ui-select ng-model="person.selected">
<ui-select-match placeholder="Select a person...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices>
<li repeat="person in people | filter:$select.search">{{person.name}}</li>
<li>Static</li>
</ui-select-choices>
</ui-select> |
I agree with the confusion with the stuff I was asking for. the valid-way2 doesn't appear to support having something fixed in the window and not scrolling. I guess it'd be upto me to try and hack that up with position: fixed and some margins? |
<ui-select ng-model="person.selected">
<ui-select-match placeholder="Select a person...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices>
<li class="top">Sticky top</li>
<li repeat="person in people | filter:$select.search">{{person.name}}</li>
<li class="bottom">Sticky bottom</li>
</ui-select-choices>
</ui-select> .ul-select-choices {
position: relative;
padding: 30px 0;
}
.top, .bottom {
position: absolute;
left: 0;
right: 0;
}
.top { top: 0; }
.bottom { bottom: 0; } |
Nice! @ProLoser, thanks so much! |
Hi, I'm looking forward to this feature too! |
This would be really nice. Is there a current workaround to make this happen? @dimirc: is there a workaround for this that's possible now? |
Another way to ask this: is there ANY way to add static choices right now? |
I know this is way late but just saw your videos and I want to point out to people that I really don't advocate using this on mobile. Especially in the way you illustrated. |
+1 for this feature (using the bootstrap theme). |
Hi! It would be great to have such feature! Are there any valid ways to make a static element now? |
Any progress? |
Bump |
The only way that I've found to do this is to add a static choice to your data, and then just remove it when you're processing it for saving. Not ideal, but it does work... |
@dmackerman Thanks, that is what I'm doing now, but it could be good that pure static or mixed styles can be supported by the module. |
Any timeline? |
+1 is a useful feature |
I would appreciate this feature as well. |
+1 |
Guys, if instead of adding these useless +1 comments, everyone of you wrote a single line of code, we would have this feature implemented long time ago. I don't want to sound aggressive, but these comments don't bring any additional value to the discussion, only pollute it and make it harder to follow. |
+1 to @korya. Also, +1 in general. |
+1 to @austinsmorris and, by proxy, to @korya. |
+1 |
2 similar comments
+1 |
+1 |
+10! |
As of right now I found a work around but since I'm still pretty new to angular I'm not sure exactly the performance problems it could bring. But it would be fantastic to be able to have a attribute directive that gets correctly transcluded. Possibly something like.
I added the
|
+1 |
still interested in this ^^ |
+1 |
I wanted to show "No results found" in the drop down when the search result is empty in the drop down. After searching without any solid solution, I came up with this workaround:
In the refresh function:
|
I've been trying to follow this discussion and related threats. It hasn't been easy. I am looking also for a way to have a static option among the Has anybody achieved this or does anybody know if there is any plan for something similar? |
+100! |
+1 |
2 similar comments
+1 |
+1 |
Please do not "+1" issues, use github 👍 reactions if you really must. Comments should be reserved for constructive discussion/issue resolution. +1s merely add unnecessary noise and scrolling between other, more helpful, replies. Other ways you can actually help include: Submitting a pull request that resolves the issue/adds the requested feature Thanks 😃 |
@korya @Jefiozie @arkarkark @trickpattyFH20, can someone give an update on this issue? Is there a way I can help? |
This would be really good to have. My use case is that I have a list of choices but would also want to have a static Add new option at the top. Any progress on this? I’d be happy to help develop it. |
I want to add a "XXX" option at the bottom, but it seems that this issue has no progress? How can I implement this now? |
There are cases where we might need to show some static info at the dropdown. We could add a new directive
ui-select-static-choice
and I was thinking of something like this:The text was updated successfully, but these errors were encountered: