ui-select icon indicating copy to clipboard operation
ui-select copied to clipboard

Input box is hidden with search-enabled="false" with Bootstrap theme

Open cdjackson opened this issue 12 years ago • 18 comments

With the Bootstrap theme, if I add the search-enabled="false" attribute, when the dropdown is clicked, the input box is hidden. This seems strange behaviour - maybe it's intended, but if so, can it be disabled? I want to keep the input box, but just not accept input (similar to how the Selectize theme works). Aside from being a nuisance in itself, it also causes the parent to resize when the dropdown is opened.

cdjackson avatar Nov 29 '14 15:11 cdjackson

+1, this is really weird and unexpected behavior.

sebastian-zarzycki avatar Dec 11 '14 13:12 sebastian-zarzycki

I think this issue is not limited to your scenario. I have a multi-select and initially the input box is 10px wide but when I click in it it expands to full width. Here is the html (using version 0.9.5):

<ui-select multiple ng-model="selected.authorizedUsers">
    <ui-select-match placeholder="Select users...">{{$item.name}}</ui-select-match>
    <ui-select-choices repeat="user in officeUsers | filter: $select.search">
        {{user.name}}
    </ui-select-choices>
</ui-select>

inputbox

erslater avatar Dec 15 '14 22:12 erslater

+1 unexpected and unable to fix without fork Please, remove it or make optional.

gen4sp avatar Jan 17 '15 11:01 gen4sp

:+1:

donbobka avatar Jan 21 '15 12:01 donbobka

+1 Just happened to me as well. Very odd.

chuckrea avatar Mar 10 '15 19:03 chuckrea

I am experiencing the same issue but with the select2 theme. Thus the issue isn't limited to the bootstrap theme.

brentmiller avatar Apr 07 '15 17:04 brentmiller

Yes, this is weird. I set a placeholder for default text ie (-select an option-). I am using the selectize theme: Two things I've noticed...1. If I switch the theme to bootstrap, the placeholder option will display. The other option was to set search-enabled to "false". Any help here would be greatly appreciated.

jedimindtrix9 avatar Apr 09 '15 19:04 jedimindtrix9

+1

Please fix this issue.

seinavco avatar Apr 12 '15 07:04 seinavco

+1 This is affecting me as well. I am working around the problem for now by specifying placeholder text using :before pseudo-selector.

Update: I can workaround using the following CSS:

  .ui-select-bootstrap[search-enabled=false] .ui-select-match.ng-hide {
    display: inline-block !important;
  }
  .ui-select-bootstrap[search-enabled=false] .ui-select-match .text-muted.ng-hide {
    display: inline !important;
  }
  .ui-select-bootstrap[search-enabled=false].ng-dirty .ui-select-match .text-muted.ng-hide {
    display: none !important;
  }

There are probably some edge cases these styles don't support very well...

SamPlacette avatar Apr 17 '15 18:04 SamPlacette

+1 It would also be desirable for this to work with the "selectize" theme.

.ui-select-container[search-enabled=false] .ui-select-match.ng-hide {
  display: inline-block !important;
}
.ui-select-container[search-enabled=false] .ui-select-match .text-muted.ng-hide {
  display: inline !important;
}
.ui-select-container[search-enabled=false].ng-dirty .ui-select-match .text-muted.ng-hide {
  display: none !important;
}

Thanks @SamPlacette.

sagivf avatar May 12 '15 13:05 sagivf

One solution that I found works well with AngularJS if you are familiar with it. The way I solved this is to simply leave the theme as selectize but target you scope in js by using a for loop like this

for(var i=0; i<$scope.yourDropDownName.length; i++){ if($scope.yourDropDownName[i].id=='US'){ $scope.model.yourScopeModelName=$scope.yourDropDownName[i]; break; } }

jedimindtrix9 avatar May 13 '15 13:05 jedimindtrix9

+1

readme42 avatar Jul 28 '15 07:07 readme42

Don't know if this is still an issue, but I fixed it without CSS by changing the template.

Before: ng-hide="$select.open"

After: ng-hide="$select.open && $select.searchEnabled"

luklapp avatar Oct 14 '15 09:10 luklapp

Thanks @SamPlacette

alusev avatar Dec 03 '15 00:12 alusev

I still have the same issue.

hkorutla avatar Jan 27 '16 21:01 hkorutla

Thanks @SamPlacette for the workaround

I've ended up using display: block for .ui-select-bootstrap[search-enabled=false] .ui-select-match.ng-hide actually.

crissdev avatar Mar 11 '16 17:03 crissdev

I have a little bit a different issue after disabling the search. There is a cursor showing with first result, when i did a inspect element i found this a input element with hidden property. I do not want to show this cursor, how can i disable this.

image

developersatish avatar Oct 27 '16 15:10 developersatish

@developersatish what version are you using?

user378230 avatar Oct 28 '16 09:10 user378230