[英]How to reduce the loading time to setvalue to the farpoint in javascript
我有一個問題,通過javascript在遠點設置vaule有很多加載時間來設置遠點的值
if (row != 0) {
if (ss.GetValue(row, col) != "") {
sTrips = parseFloat(ss.GetValue(row, col));
}
if (ss.GetValue(0, col) != "") {
sWrkDays = parseFloat(ss.GetValue(0, col));
}
for (var i = 1; i < ssDet.GetRowCount(); i++) {
if (ssDet.GetValue(i, 7) != "") {
sMaxCapacity = parseFloat(ssDet.GetValue(i, 7));
sVal = 0;
sVal = sMaxCapacity * sTrips * sWrkDays;
var cell = ssDet.GetCellByRowCol(i, col + 5);
cell.removeAttribute("fpcelltype");
ssDet.SetValue(i, col + 5, sVal);
cell.setAttribute("FpCellType", "readonly");
}
}
}
嘗試以下優化代碼以獲得更好的結果
if (row != 0) {
var sTripsVal = ss.GetValue(row, col);
var workingDays = ss.GetValue(0, col);
if (sTripsVal != "") {
sTrips = parseFloat(sTripsVal);
}
if (workingDays != "") {
sWrkDays = parseFloat(workingDays);
}
for (var i = 1; i < ssDet.GetRowCount(); i++)
{
var MaxCapacity = ssDet.GetValue(i, 7);
if (MaxCapacity != "")
{
sMaxCapacity = parseFloat(MaxCapacity);
sVal = 0;
sVal = sMaxCapacity * sTrips * sWrkDays;
var cell = ssDet.GetCellByRowCol(i, col + 5);
cell.removeAttribute("fpcelltype");
ssDet.SetValue(i, col + 5, sVal);
cell.setAttribute("FpCellType", "readonly");
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.