ui-select
ui-select copied to clipboard
Disable first refresh call
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
i need that too.
Some news?
In refresh function try add: refreshGroups(search){ if(!search) return; }
@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.
+1
+1
+1
Hi, can maybe somebody have a look at this and make a PR?
+1000000000
+1
+1
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;
}
...
}