function UltraWebGrid1_AfterCellUpdate(gridName, cellId){
//Add code to handle your event here.
var oRow=igtbl_getActiveRow(gridName);
var col = igtbl_getColumnById(cellId)
if (col.Key=="Quantity"||col.Key=="Price"||col.Key=="TaxRate")
{
Quantity = oRow.getCellFromKey("Quantity").getValue();
Price = oRow.getCellFromKey("Price").getValue();
TaxRate = oRow.getCellFromKey("TaxRate").getValue();
if (Quantity==null) Quantity = 0;
if (Price==null) Price = 0;
if (TaxRate==null) TaxRate = 0 ;
oRow.getCellFromKey("Amount").setValue(Quantity*Price*(100+TaxRate)/100);
}
}// -->
//Add code to handle your event here.
var oRow=igtbl_getActiveRow(gridName);
var col = igtbl_getColumnById(cellId)
if (col.Key=="Quantity"||col.Key=="Price"||col.Key=="TaxRate")
{
Quantity = oRow.getCellFromKey("Quantity").getValue();
Price = oRow.getCellFromKey("Price").getValue();
TaxRate = oRow.getCellFromKey("TaxRate").getValue();
if (Quantity==null) Quantity = 0;
if (Price==null) Price = 0;
if (TaxRate==null) TaxRate = 0 ;
oRow.getCellFromKey("Amount").setValue(Quantity*Price*(100+TaxRate)/100);
}
}// -->
本文介绍了一个用于 UltraWebGrid 控件的 JavaScript 函数,该函数在单元格更新后自动计算并更新对应行的金额字段。涉及的关键字段包括数量(Quantity)、价格(Price)和税率(TaxRate),并在更改后重新计算金额(Amount)。此方法适用于需要实时计算总计的应用场景。
1万+

被折叠的 条评论
为什么被折叠?



