-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add disabled property to SelectItem interface #586
Comments
SelectItem is actually an interface, so you can just implement the interface in a class that you create and then use that class for the dropdown. |
Yes, sure I can easily implement that interface but I can't change the component's behaviour to not select or highlight those items. Maybe I'm missing something, but I don't see a way to alter the selectItem(event, item) function within the component to implement that logic. If there is a better way to accomplish this, I'll be happy to close this FR. |
There is a disabled field for dropdowns. The documentation is kind of lacking for a lot of components, but if you look through you source you can find all of them The signature is: @input() disabled: boolean; |
Thanks for the suggestion, I did look at the dropdown component code and couldn't find a good way to do this hence the Feature Request. Your suggestion won't work as it disables the component completely. You can't even click on the dropdown if the component is disabled. e.g. Items:
|
I only briefly looked through the source Looking at the component more indepth I don't really see a way to achieve what you want to do. I agree that this would be a very nice feature to have. |
I agree with you both. Disabled Dropdown's options, which means disabled property on SelectItem, would be a great improvement. It's a quite big change because it would also affect Listbox, MultiSelect and SelectButton ;-) |
Any status update on this? |
This would be great to have. +1 |
We can add itemDisabled property to SelectItem interface. |
It would be nice to add a style or styleClass property to. |
I wrote a little workaround to add support for disabled options: https://stackoverflow.com/questions/43873162/prime-ng-dropdown-disable-certain-selectitems/45362622#45362622. |
Is there some way to work around this for SelectButton? I tried writing get/set for the selected item, and prevent selection if disabled, It still highlights the clicked button. Not being able to disable an option makes the use of this very limited. |
+1. I'm running into this issue all the time. The use case is as follows: add item from a list of items, already added items(duplicate) are not allowed. Yes, already added items can be removed from the add list but from the users point of view it's unclear what is happening. Disabling instead of removing would provide additional clarity to the user what is happening. |
+1. I currently have a form array with dropdowns, will be useful to disable items previously selected with this. |
+1. We need this feature to be compatible with SelectButtons. |
Voting for having it for MultiSelect +1 |
SelectItem now has styleClass, icon and title but still no disabled property. Any idea when this will happen as it's clearly something that many people need? |
Agree @paulswan, disabled property is very much needed. or is there an alternative way of doing with? |
@hemanthbs12 we solve it by using two buttons with padding 0px and we control enable and disabled individually based on the state of the other. @cagataycivici another interest functionality is an event triggered before selectbutton change state occurs, so we can block the change of selected option. |
Set to 6.0, although I personally think not displaying the option would be a better UX. However there is demand so we will do it for sure in 6.0. |
That sounds great @cagataycivici, do you have an idea when release is due? I've looked through the roadmap and can't find much, I also see the 6.0 milestone has no current due date. |
It will be synced with Angular 6 which I believe will be before Ng-Conf, mid april. |
@cagataycivici Any idea when 6.0 will be out. |
SelectItem API gets disabled prop with 6.0.2 and now we're updating components such as ListBox that should utilize it; Each component that supports it has its own ticket. |
Would you please consider allowing the SelectItem class to specify a 'selectable' variable? The use case would be for the first item I want to show a default value of "Select One Item" or something to that effect. I don't want the user to be able to select that option in dropdowns etc.
Thanks
The text was updated successfully, but these errors were encountered: