一、第一步獲取數據源bootstrap
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
});this
二、表格改動屬性的標籤 加入一下兩個屬性ip
data-index="' + index + '" onkeyup="GetInputByQuatity(this)"it
data-index="' + index + '" onkeyup="GetInputBySumprices(this)"io
三、再寫入標籤兩個方法 須要不刷新的字段 保存下來一下兩個方法table
function GetInputByQuatity(obj)
{
var row = {
pronum: $(obj).val(),
sumprice: 10.0
}
$('#gridList').bootstrapTable('updateRow', { index: $(obj).data('index'), row: row })
}function
function GetInputBySumprices(obj) {
var row = {
pronum: 5,
sumprice: $(obj).val()
}
$('#gridList').bootstrapTable('updateRow', { index: $(obj).data('index'), row: row })
}date
四、表格刷新List
$("#gridList").bootstrapTable('refresh');grid