我需要做的这个帖子的对立面,“Best way to iterate over an array without blocking the UI”如何阻止用户界面长期运行的JavaScript循环
我通过数百行必须循环,并为每一个值。但是,在我允许用户执行下一步并将更新的行提交到数据库之前,该工作必须完成。
JavaScript代码如下。
// toolbar events/actions
changeZeroDiscountButton.click(function (event) {
var value = discountComboBox.jqxComboBox('val');
if ((value != null) && (value != "")) {
value = value/100;
// get all the rows (this may have to be changed if we have paging
var datainformations = $('#jqxgrid').jqxGrid('getdatainformation');
var rowscounts = datainformations.rowscount;
for (var i = 0; i < rowscounts; i++) {
var preSetDiscount = $("#jqxgrid").jqxGrid('getcellvalue', i, "discount");
if (preSetDiscount == .0000) {
$("#jqxgrid").jqxGrid('setcellvalue', i, "discount", value);
}
}
}
});
你使用引导? – jonju
Sorta。它是Joomla组件的一部分,Joomla支持一些Bootstrap功能。 – NJA