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

Disable first refresh call

Open furyscript opened this issue 8 years ago • 12 comments

Hi all,

I've found a problem in ui-select with binding remote data. This is my code

<ui-select ng-model="group.selected" theme="bootstrap" ng-disabled="group_disabled" reset-search-input="false">
                <ui-select-match placeholder="Select a group...">{{$select.selected.name}}</ui-select-match>
                <ui-select-choices repeat="group in groups | propsFilter: {name: $select.search}" refresh="refreshGroups($select.search)" refresh-delay="0">
                    <div ng-bind-html="group.name | highlight: $select.search"></div>
                    <small>Description: {{ group.description }}
                    </small>
               </ui-select-choices>
            </ui-select>

I want that the call to remote server starts after user keyup on input and not before. I see that the call start after the page is loaded

Regards, FS

furyscript avatar Sep 17 '15 14:09 furyscript

i need that too.

uguryilmaz avatar Oct 01 '15 08:10 uguryilmaz

Some news?

furyscript avatar Oct 05 '15 13:10 furyscript

In refresh function try add: refreshGroups(search){ if(!search) return; }

AlexSin15 avatar Nov 03 '15 10:11 AlexSin15

@AlexSin15 I tried that, but if I do it like that, when clicking (ie. focusing) the input, nothing happens except that the arrow disappears, but there is no focus on the input. You have to click the input again to get actual focus.

edu2004eu avatar Feb 18 '16 12:02 edu2004eu

+1

ganholete avatar Jun 02 '16 21:06 ganholete

+1

luzrafaelf avatar Nov 09 '16 13:11 luzrafaelf

+1

stepanO avatar Jan 24 '17 12:01 stepanO

Hi, can maybe somebody have a look at this and make a PR?

Jefiozie avatar Jan 25 '17 17:01 Jefiozie

+1000000000

Condor2708 avatar Jun 10 '17 08:06 Condor2708

+1

Leftyx avatar Aug 23 '17 15:08 Leftyx

+1

andrewcylaw avatar Feb 08 '18 20:02 andrewcylaw

Solution? https://github.com/angular-ui/ui-select/pull/1845#issuecomment-258615839

You just both pass the search filter and the open boolean: refresh="fetchFromServer($select.search, $select.open)"

Then in your fetch function you check if $select.open is true:

 $fetchFromServer = function (filter, isOpen) {
            if (!isOpen) {
                return;
            } 
...
}

aske-cph avatar May 15 '19 07:05 aske-cph