$(function () {
var options = {
url: prefix + "/init",
sortName: "createTime",
sortOrder: "desc",
modalName: "空箱",
search: false,
showExport: false,
uniqueId: 'index',
columns: [
{
field: 'index',
align: 'center',
title: '序号',
formatter: function (value, row, index) {
return index + 1;
}
},
{
field: 'containerType',
align: 'center',
title: '箱型'
},
{
field: 'quantity',
align: 'center',
title: '数量'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('编辑 ');
actions.push('删除 ');
return actions.join('');
}
}],
showToggle: false,
showColumns: false,
showSearch: false,
showRefresh: false
};
$.table.init(options);
});
function addDetail() {
var _data = {
"containerType": $("#containerType option:selected").val(),
"quantity": $("input[name='quantity']").val()
};
$("#bootstrap-table").bootstrapTable('prepend', _data);
}
function delDetail(index) {
console.log([parseInt(index)]);
$('#bootstrap-table').bootstrapTable('remove', {
field: "index",
values: [parseInt(index)]
});
}
上面这个删除方法删不掉