title : '操作',
formatter:function (value, row, index) {
var actions = [];
actions.push('<i style="color:red;vertical-align: middle" οnclick="deleteRow2(\'bootstrap-table\',' + index + ')" class="glyphicon glyphicon-trash"></i>');
actions.push(' <i style="color:green;vertical-align: middle" οnclick="insertRow2(\'bootstrap-table\',' + index + ')" class="glyphicon glyphicon-plus-sign"></i></div>');
return actions;
function insertRow(index){
$("#bootstrap-table").bootstrapTable('insertRow', {
index: index + 1,
row: {}
});
function insertRow(index){
$("#bootstrap-table").bootstrapTable('insertRow', {
index: 0,
row: {
id: '',
name: '',
price: ''
});
var datas = $("#" + tableId).bootstrapTable(('getData'));
datas.splice(index, 0,value);
$("#" + tableId).bootstrapTable('load', datas);
function deleteRow(tableId,field,value){
$('#' + tableId).bootstrapTable('remove', {
field:field,
values: [value]
});
$('#exampleTable').bootstrapTable('removeByUniqueId', value);
var datas = $("#" + tableId).bootstrapTable(('getData'));
datas.splice(index, 1);
$("#" + tableId).bootstrapTable('load', datas);