angularjs - ui-select multiselect is very slow in displaying the choices -
i ran problem, , don't know how solve it. have used ui-select multiselect in page. first, http.get request made url gets data, ui-select choices populated. data big - length of data 2100. data shown choices. (the data fetched @ beginning during loading of page , stored in array)
but problem each time click on multiselect select choice, takes 4-5 seconds populate list , page becomes slow. do reduce time?
the choices data stored in array, datatype array of strings.
<ui-select multiple ng-model="selectedfields.name" style="width: 100%;"> <ui-select-match placeholder="select fields...">{{$item}}</ui-select-match> <ui-select-choices repeat="fields in availablefields | filter:$select.search"> {{fields}} </ui-select-choices> </ui-select>
in controller,
$scope.selectedfields = {}; $scope.selectedfields.name = []; $scope.init = function() { $http.get(url) .success( function(response, status, headers, config) { availablefields = response; }) .error( function(err) { }); }; $scope.init();
if not way, there other options/choice can work doesn't delay showing select-choices?
this known issue in ui-select. tried following ways, both work
1) there workaround - use
| limitto: 100
this limits choice display 100 choices can selected. @ this thread more details.
2) since of time, there need display entire list in choices, 1) not viable option. used different library - selectize.js. here's plunker demo given in page
Comments
Post a Comment