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

"No results" for select2 theme

Open kanwei opened this issue 12 years ago • 11 comments

select2 supports displaying of a message when there aren't any results. I'm working on a patch to enable this.

`

  • ``

    kanwei avatar Jul 25 '14 02:07 kanwei

    +1

    teneightfive avatar Jul 29 '14 13:07 teneightfive

    Check https://github.com/angular-ui/ui-select/issues/152 for possible solution, let me know your opinion

    dimirc avatar Aug 11 '14 03:08 dimirc

    Until #152 gets added, I'm using the filter from http://stackoverflow.com/a/23452217/1921234.

    When we get nothing back from the server I add {text: "No Results...", id: ''} to the options. And I added this line at the beginning of the filter so it will show up. if(input.length == 1 && input[0].text == 'No Results...') return input;

    michaeldjeffrey avatar Sep 29 '14 19:09 michaeldjeffrey

    +1 to this. I'm going to have to see if I can wrap something around the ui-select directive in order to support this throughout my application. It would be great if there was a directive under the ui-select directive that I could define.

    MikeABentley avatar Feb 12 '15 20:02 MikeABentley

    +1

    caseahr avatar Mar 06 '15 17:03 caseahr

    +1

    junajan avatar Apr 17 '15 12:04 junajan

    Alternatively

    <ui-select> 
        <ui-select-match>
            {{$select.selected}}
        </ui-select-match>
        <ui-select-choices repeat="option in options | filter: $select.search" refresh="refreshOptions($select.search)" refresh-delay="500">
            <div ng-bind-html="option | highlight: $select.search"></div>
        </ui-select-choices> 
    </ui-select>
    <div class="text-warning" ng-if="options.length == 0">Nothing found</div>
    

    fabio-paiva-sp avatar Oct 14 '15 19:10 fabio-paiva-sp

    @fabiopaiva your solution would work only if the options are empty, not when the user search filter makes them empty...+1 for a real solution

    nadavsinai avatar Nov 10 '15 13:11 nadavsinai

    @nadavsinai then you shouldn't use a filter but instead do the filtering in your refresh function.

    erikdubbelboer avatar Nov 10 '15 14:11 erikdubbelboer

    @nadavsinai The real solution is always the best

    fabio-paiva-sp avatar Nov 10 '15 14:11 fabio-paiva-sp

    Closing due to the age of the issue - if this is still a problem, please open a new issue with adequate reproduction in Plunker.

    wesleycho avatar Mar 27 '16 06:03 wesleycho