gpt4 book ai didi

jquery - Bootstrap 选择加载在 IE 中花费的时间太长

转载 作者:行者123 更新时间:2023-12-03 22:15:33 28 4
gpt4 key购买 nike

我正在将 1000 条记录加载到 Bootstrap 选择下拉列表中。在 Chrome 中大约需要 2 秒,但在 IE 9 中需要 30 秒。此外,在 IE 中取消或取消 Bootstrap 模式也需要 10 秒以上。 API调用可以,但是渲染太慢;有人可以给我一些指导吗?

因此,我正在加载客户列表并设置所选内容。这是代码。

    var customerPicker = $('#customer-picker');
API.getCustomers().then(function (result) {
loadDropdown(customerPicker, result.customers);

// set the selected to current customer; it takes 10s in IE
customerPicker.val(currentCustomerId).selectpicker('refresh');

// it takes about 10s in IE too. selector is the bs modal div
$(selector).css('z-index', '1060').modal('show');
}).catch(function (errorMessage) {
ToastManager.showError(errorMessage || 'An error occurred while loading customer list. Please try again.');
});

function loadDropdown($div, arr) {
var options = '';
$.each(arr, function (i, item) {
options = options + '<option value="' + item.Value + '">' + item.Text + '</option>';
});
$div.html(options);
}

enter image description here

最佳答案

您是否尝试过在循环内设置innerHTML;

 $div[0].innerHTML += '<option value="' + item.Value + '">' + item.Text + '</option>';

而不是最后的这个。;

 $div.html(options);

关于jquery - Bootstrap 选择加载在 IE 中花费的时间太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41174267/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com