Skip to content
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

Closed
jpicklyk opened this issue Jul 11, 2016 · 24 comments
Closed

Add disabled property to SelectItem interface #586

jpicklyk opened this issue Jul 11, 2016 · 24 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@jpicklyk
Copy link

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

@kcaebe
Copy link

kcaebe commented Jul 11, 2016

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.

@jpicklyk
Copy link
Author

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.

@kcaebe
Copy link

kcaebe commented Jul 12, 2016

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;

@jpicklyk
Copy link
Author

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.
What I am looking for is similar behaviour to the JSF dropdown component where I am able to specify if the SelectItem is selectable or not.

e.g. Items:

  • Please select one <-- Not selectable at all
  • Item 1
  • Item 2
  • Item 3

@kcaebe
Copy link

kcaebe commented Jul 12, 2016

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.

@upstreamosGH
Copy link

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 ;-)

@raxkaynan
Copy link

Any status update on this?

@bomberblue07
Copy link

This would be great to have. +1

@cagataycivici
Copy link
Member

We can add itemDisabled property to SelectItem interface.

@cagataycivici cagataycivici changed the title Feature Request - Extend SelectItem to support selectable true/false Add disabled property to SelectItem interface May 27, 2017
@cagataycivici cagataycivici added the Type: New Feature Issue contains a new feature or new component request label May 27, 2017
@Samisama
Copy link

It would be nice to add a style or styleClass property to.
I can't figure out how to style options inside my dropdown (for example I would like to change the text color of a few items but not all options of the dropdown)

@andriy101
Copy link
Contributor

andriy101 commented Jul 27, 2017

@mconner
Copy link

mconner commented Oct 23, 2017

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.

@j1j
Copy link

j1j commented Oct 28, 2017

+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.

@carlos-ruiz-bravo
Copy link

+1. I currently have a form array with dropdowns, will be useful to disable items previously selected with this.

@skormel
Copy link

skormel commented Nov 14, 2017

+1. We need this feature to be compatible with SelectButtons.

@paveldayneko
Copy link

Voting for having it for MultiSelect +1

@paulswan
Copy link

paulswan commented Feb 1, 2018

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?

@hemanthbs12
Copy link

Agree @paulswan, disabled property is very much needed. or is there an alternative way of doing with?

@skormel
Copy link

skormel commented Feb 2, 2018

@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.

@cagataycivici
Copy link
Member

cagataycivici commented Mar 4, 2018

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.

@michael-veitch
Copy link

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.

@cagataycivici
Copy link
Member

It will be synced with Angular 6 which I believe will be before Ng-Conf, mid april.

@hemanthbs12
Copy link

@cagataycivici Any idea when 6.0 will be out.

@cagataycivici cagataycivici added this to the 6.1.0 milestone Jun 20, 2018
@cagataycivici cagataycivici modified the milestones: 6.1.0, 6.0.2 Jul 24, 2018
@cagataycivici
Copy link
Member

SelectItem API gets disabled prop with 6.0.2 and now we're updating components such as ListBox that should utilize it;

#6145

Each component that supports it has its own ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests