Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Added miniumResultsForSeach #113

Closed
wants to merge 1 commit into from

Conversation

LukeBaulch
Copy link

Added custom attribute 'minimumResultsForSelect' to ui-select directive which will remove the 'select2-with-search' class.

Added styles to hide the search if the 'select2-with-search' class is not applied.

Updated examples to include a case where the search is hidden.

Resolution for Issue #54

@LukeBaulch LukeBaulch changed the title Added miniumResultsForSeach [Issue #54] Added miniumResultsForSeach Jul 18, 2014
@dimirc
Copy link
Contributor

dimirc commented Aug 1, 2014

@LukeBaulch can you rebase this? also we should think about how the other themes can implement this feature

@sambomartin
Copy link

Hi Luke, Dimirc,

I'd pretty done the same change (locally) as you Luke. The difference is that I didn't use a function to determine whether to show the search box. I think it's better though with the showSearch function.

The key difference is that I modified the template (bootstrap) to deal hiding and showing the search box.

select.tpl.html

<div class="ui-select-bootstrap dropdown" ng-class="{open: $select.open}">
    <div class="ui-select-match"></div>
    <input type="text" autocomplete="off" tabindex="-1"
           class="form-control ui-select-search"
           placeholder="{{$select.placeholder}}"
           ng-model="$select.search"
           ng-show="$select.open && $select.showSearch()">  
    <div class="ui-select-choices"></div>
</div>

and match.tpl.html

<button type="button" class="btn btn-default form-control ui-select-match" tabindex="-1"
        ng-hide="$select.open && $select.showSearch()"
        ng-disabled="$select.disabled"
        ng-class="{'btn-default-focus':$select.focus}"
        ng-click="$select.activate()">
    <span ng-show="$select.isEmpty()" class="text-muted">{{$select.placeholder}}</span>
    <span ng-hide="$select.isEmpty()" ng-transclude></span>
    <span class="caret"></span>
</button>

@LukeBaulch
Copy link
Author

I just found an issue with my solution. It seems that the collection i was looking at to determine the item count is the post-filtered list, which means if you type into the input filter, it might disappear when the results falls below the defined threshold.
Unfortunately, my schedule just got very busy so not sure when I'll find time to look into it.

@brettstack
Copy link

+1

@sambomartin
Copy link

Dimic. I'm not entire sure of the process for proposing a change to you.

Do I just clone the repo, make the changes and do a pull request?

The solution I have now has keypress handler (on the button) and takes a count of the total data items directly after the parser is created. Tested under IE8.

Please advise

Sam

@noullet
Copy link

noullet commented Apr 2, 2015

+1

@aaronroberson
Copy link
Contributor

@LukeBaulch does #166 resolve this issue?

@sambomartin, your can fork the repo, make your changes, commit and then make a pull request. For more information please see the following https://help.github.com/articles/using-pull-requests/

@Jefiozie
Copy link
Contributor

Jefiozie commented Nov 3, 2016

As the initial PR was for issue #54 and that is closed I think this can be closed as wel?? @user378230 @aaronroberson

@user378230 user378230 closed this Nov 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants