table的呈现
- 前端
<div class="col-sm-12 panel panel-default table-responsive">
<table id="tabAll" class="table table-condensed"></table>
</div>
- ajax请求获取数据
function getTable(res) {
operateEvents = {
'click .btnEdit': function (e, value, row, index) {
if (res) {
edit(row);
}
else {
alert('You do not have permission');
}
}
}
$('#tabAll').bootstrapTable({
url: 'ajax/ActionHandler.ashx?action=getDataConveyor',
dataType: "json",
search: true,
//showExport: true,
pagination: true,
pageSize: 15,
pageList: [15, 20, 40],
contextMenu: '#example1-context-menu',
onClickRow: function (row, $el) {
$('#tabAll').find('.error').removeClass('error');
$el.addClass('error');
},
onContextMenuItem: function (row, $el) {
if (res) {
if ($el.data("item") == "Spare") {
AddMaintenance(row);
}
}
else {
alert('You do not have permission');
}
},
columns: [
{
field: 'con_id',
title: '资产编号',
}, {
field: 'con_name',
title: '品名',
}, {
field: 'current_loc',
title: '当前位置',
}, {
field: 'size',
title: '规格(米)',
}, {
field: 'con_spec',