Minimum Input support
There does not seem to be support for a minimum input length prior to searching? (Same as select2's Minimum Input)
Particularly in large data sets it means searching is rather slow, and 1-2 character search terms are not particularly useful.
I would also love this! In the meantime is there any workaround?
@kevinswartz I've made workaround like this: http://pastebin.com/dcfE07pg so 1.refresh="checkCountry($select.search)" - function fired after user enter some characters and then in this function if (country_name.length >= 3){}
@masscrx Thanks! I actually ended up implementing nearly the same thing the other day.
I don't really understand this line: DataFactory.search('countries', country_name, 1, 20)
I have an init function that provides a full list of users for my select for example:
<ui-select-choices repeat="User in User.collection | filter: $select.search">
init: function (){
UserService.loadUsers().then(function (result){
User.collection = result;
});
},
How could I implement a limit like you have into this for example?
EDIT: Even the result.plain() could you explain what that does?
+1
+1
Was this missed in the milestone. We're on 11.1 now but the milestone was set to 10 :/
Using angular's limitTo in the repeater would probably help:
<ui-select-choices repeat="item in items | filter: $select.search | limitTo: 50">
Fixed the slowness for me, at least :grinning:
@reichert621 So I tested it and it turns out that limitTo does what I expected. It returns only the n value specified and nothing else, and there's no pagination until Angular 1.4 with the begin parameter. So I'm guessing you can use some function to update the begin value dynamically.
https://code.angularjs.org/1.4.0-beta.6/docs/api/ng/filter/limitTo
+1 minimum input support
line 313 in select.js: if (!ctrl.disabled && !ctrl.open && ctrl.search.length > 2) also line 1359: if ($select.tagging.isActivated && $select.search.length > 2)
+1
looking forward to 0.13.3 for this commit, hopefully we can make this length as an option.
this commit is a bit too much, on dist ? and also it only changes two lines, but the file look like it changed a lot of places.
ok, the above commit does not work at all, and i find a easy way using just css, here's the solution.
<ui-select ng-model="selectedItem">
<ui-select-match>...</ui-select-match>
<ui-select-choices repeat="item in (itemArray | filter: $select.search | limitTo:10) track by item.id" group-by="'type'" ng-class="{hide: $select.search.length < 3 }">
...
</ui-select-choices>
</ui-select>
now you can just set the css to be
.ui-select-choices {
&.hide {
display: none;
}
}
Sorry, I did not intend to reference this issue from my fork (lot of useless changes indeed, due to my text editor removing trailing spaces).
Thank you @thefewminutes anyway for your idea !
This worked for me, but I'll try your css @windmaomao, thanks !
+1 optional minimum length support
Implemented in #1291 & d89a869d53b918724d7a8a4c6cbcc90c477e21ea (v0.14.0)