我正在将1000条记录加载到引导选择下拉列表。 Chrome浏览器大约需要2秒,但在IE 9中需要30秒。另外,取消或x在IE中的引导模式也需要10 + s。 API调用没问题,但渲染速度很慢;有人能给我一些方向吗?引导选择加载在IE中花费太长时间
所以我正在加载一个客户列表并设置所选。这是代码。
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);
}
您是否尝试过'$ div.append('
@RobinMackenzie是的,我试过没有运气。 – Quentin
你使用的是什么版本的jQuery?你很可能通过尝试不同的jQuery发布来解决这个问题,因为你提到的两个函数都直接与js打交道。 –