Bootstrap-Table中给一列数据中添加查看、修改、删除功能
只需要在columns中的表格参数中加入这段代码即可:
{
field: 'operator',
title: '操作',
align: 'center',
sortable: true,
width:'6%',
formatter: function (value, row, index) {
return '<a href="${ctx}/standardlanguage/standardlanguage/form?id='+row.id+'">' +
'<i class="glyphicon glyphicon-eye-open" title="查看"></i>' +
'</a>'+
'<a href="${ctx}/standardlanguage/standardlanguage/form?id='+row.id+'" data-toggle="modal" title="修改">' +
'<i class="glyphicon glyphicon-pencil"></i>' +
'</a>'+
'<a href="javascript:void(0)" title="删除">' +
'<i class="glyphicon glyphicon-trash text-danger"></i>' +
'</a>';
},
events: {
'click a[title=删除]': function (e, value, row, index) {
jp.confirm('确认要删除该条表单记录吗?', function(){
jp.loading();
jp.get("${ctx}/standardlanguage/standardlanguage/delete?id=" + row.id, function(data){
if(data.success){
$('#standardLanguageTable').bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
})
})
},
'click a[title=修改]': function (e, value, row, index) {
},
}
}
这样就能快速实现该功能,效果图如下:
该代码实现的功能就是红色标注的部分!!