简体   繁体   中英

AngularJS isteven-multi-select limit display options

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.

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"'

May be try this one:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM