AngularJS isteven-multi-select limit display options

别说谁变了你拦得住时间么 提交于 2019-12-08 09:40:02

问题


I am using the isteven-multi-select to display select options from DB. Unfortunatelly it could be really large array (from "a few" to "+100K" records). That is the reason why I use a smart select with a filter. Is there any way how can I set limit of rendering options to improve performance? Currently the large array drop down a js and a firefox.

My select:

<div isteven-multi-select
     input-model="data.select.options"
     output-model="data.select.data" 
     button-label="label"
     item-label="id label"
     tick-property="ticked"
     max-labels="4" >
 </div>

Controller:

...
DataInfoResource.query(
    function(data) {
        $scope.data.select.options = data;
        console.log(data);
    }
);
....

I also tried select2 but I do not find any way how to do it.

Thanks for any advice.


回答1:


This is what I did when the list size is more. Not sure if it would work for 100k records but still you can try. It really worked well for 6k record. Modified the template in isteven-multi-select.js as follows

'ng-repeat="item in filteredModel | filter:removeGroupEndMarker" class="multiSelectItem"'

to

'ng-repeat="item in filteredModel | filter:removeGroupEndMarker | limitTo:100" class="multiSelectItem"'




回答2:


May be try this one:

<div isteven-multi-select ... max-height="250px"></div>

PS. I can't add a comment because the following answer



来源:https://stackoverflow.com/questions/36712528/angularjs-isteven-multi-select-limit-display-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!