ng-multiselect-dropdown icon indicating copy to clipboard operation
ng-multiselect-dropdown copied to clipboard

Hide checkboxes on singleSelection: true

Open helloscoopa opened this issue 3 years ago • 9 comments

When the singleSelection is true, there is no need of showing checkboxes in my opinion because anyways the user can select only one item. so if that prop is true, it should work just like a normal combobox with the lovely typeahead. also, that selected item tag preview is also not appropriate at that point because there will be only one selection so we can show just the selected value instead of as a tag. I really enjoyed this plugin and loved your work @NileshPatel17

Thanks,

ref: selected item tag preview Capture

helloscoopa avatar Oct 03 '20 06:10 helloscoopa

Hi, Any idea about this? Also would be great if we can even show radio button circle instead of checkbox.

exsc185 avatar Nov 03 '20 10:11 exsc185

@exsc185 In my opinion, we don't even need to have radio buttons. because whenever we choose an item from the dropdown list if the singleSelection is true, the dropdown should hide automatically revealing the selected item right because there are no more choices to make. if the user changed his mind, he can open the dropdown again and choose whatever they want. So basically, it should work as a raw HTML <select> tag with added typeahead search functionality when the singleSelection is true.

helloscoopa avatar Nov 16 '20 12:11 helloscoopa

@scoopz , yes makes sense. But just from look and feel perspective radio button or just values without checkbox would look better.

exsc185 avatar Nov 16 '20 12:11 exsc185

@exsc185 yeah, that's what I mentioned. we don't need the checkboxs nor the radio buttons. Just the dropdown with text values would work for single selection. I mean it simplifies the user experience. also as mentioned in the original post, we need to remove the tag view since it doesn't make any sense when there are no multiple. instead need to show the selected value as a whole just like a normal <select> in html.

helloscoopa avatar Nov 16 '20 12:11 helloscoopa

@scoopz 100%

exsc185 avatar Nov 16 '20 12:11 exsc185

@exsc185 @scoopz This change will be coming up soon.

NileshPatel17 avatar Dec 04 '20 19:12 NileshPatel17

Hi folks, any new solution about this: "Hide checkboxes on singleSelection"? Thanks in advance @NileshPatel17 ?

Markoniraz avatar Feb 17 '21 09:02 Markoniraz

hi @NileshPatel17 Thanks for nice library. any update above issue. i am also looking for this enhancement.

sireeshap avatar Mar 09 '21 07:03 sireeshap

you can add below css by adding singleSelection class in your element

.singleSelection .dropdown-list input[type="checkbox"]+div:before { display: none; }

.singleSelection input[type="checkbox"]+div:after { display: none; }

.singleSelection input[type="checkbox"]+div { padding: 6px 10px !important; }

.singleSelection input[type="checkbox"]:checked+div { background-color: #337ab7 !important; color: #fff !important; }

himanshumittal90 avatar Apr 25 '22 09:04 himanshumittal90