1、第一步获取数据源
var rows = { //要插入的数据,这里要和table列名一致
SkuCode: data.rows[i].SkuCode,
BarCode: data.rows[i].BarCode,
ProductName: data.rows[i].ProductName,
prospec: data.rows[i].prospec,
ItemName: data.rows[i].ItemName,
ReceiptQuantity: 0,
LnQuantity: data.rows[i].LnQuantity,
NotQuantity: 0,
CostPrice: data.rows[i].CostPrice,
YKPrice: "",
SkuId: data.rows[i].SkuId,
ProId: data.rows[i].ProId
}
$(‘#gridList‘).bootstrapTable(‘insertRow‘, {
index: 0,
row: rows
});
2、表格改动属性的标签 加入一下两个属性
data-index="‘ + index + ‘" onkeyup="GetInputByQuatity(this)"
data-index="‘ + index + ‘" onkeyup="GetInputBySumprices(this)"
3、再写入标签两个方法 需要不刷新的字段 保存下来一下两个方法
function GetInputByQuatity(obj)
{
var row = {
pronum: $(obj).val(),
sumprice: 10.0
}
$(‘#gridList‘).bootstrapTable(‘updateRow‘, { index: $(obj).data(‘index‘), row: row })
}
function GetInputBySumprices(obj) {
var row = {
pronum: 5,
sumprice: $(obj).val()
}
$(‘#gridList‘).bootstrapTable(‘updateRow‘, { index: $(obj).data(‘index‘), row: row })
}
4、表格刷新
$("#gridList").bootstrapTable(‘refresh‘);