bootstrapTable绑定不出数据,ajax返回的数据如下:
展开全部
你返回的json数据应该是:rows:[{},{}]
$(function () {
var oTable = new TableInit();
oTable.Init();
});
var TableInit = function () {
var oTableInit = new Object();
oTableInit.queryUrl = '/Official/GetSearchFileList' + '?rnd=' +Math.random();
//初始化Table
oTableInit.Init = function () {
$('#table-javascript').bootstrapTable({
method: 'get',
url: oTableInit.queryUrl,
height: $(window).height() - 290,
striped: true,
pagination: true,
singleSelect: false,
pageSize: 2,
pageNumber: 1,
pageList: [10, 50, 100, 200, 500],
search: false, //不显示 搜索框
showColumns: false, //不显示下拉框(选择显示的列)
sidePagination: "server", //服务端请求
queryParams: oTableInit.queryParams,
minimunCountColumns: 2,
queryParamsType: "",//分页参数设置
formatNoMatches: function () {
return '未检索到**信息';
},
columns: [
{
field: 'BH',
title: '序号',
width: 20,
align: 'center',
valign: 'middle',
sortable: false,
}, {
field: 'TITLE',
title: '**名称',
width: 200,
align: 'left',
valign: 'top',
sortable: false,
}, {
field: 'Creater',
title: '创建人',
width: 50,
align: 'left',
valign: 'top',
sortable: false
}, {
field: 'CreateTime',
title: '创建时间',
width: 110,
align: 'middle',
valign: 'top',
sortable: false
}, {
field: 'operate',
title: '操作',
width: 100,
align: 'center',
valign: 'middle',
formatter: operateFormatter,
events: operateEvents
}],
onLoadSuccess: function () {
//layer.msg('加载成功');
},
onLoadError: function () {
layer.msg('未检索到**信息');
}
});
};
//销毁表格
oTableInit.Destory = function () {
$('#table-javascript').bootstrapTable('destroy');
};
//得到查询的参数
oTableInit.queryParams = function (params) {
var temp = {
pageSize: params.pageSize,
pageIndex: params.pageNumber,
Title:$("#Title").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val()
};
return temp;
};
return oTableInit;
};
function operateFormatter(value, row, index) {
return '<a class="detail" style="color:#428bca;cursor:pointer;" >查看</a>';
}
window.operateEvents = {
'click .detail': function (e, value, row, index) {
var url = '@Url.Content("~/**/**?id=")' + row.ID;
window.open(url, '_blank');
}
};
$(function () {
var oTable = new TableInit();
oTable.Init();
});
var TableInit = function () {
var oTableInit = new Object();
oTableInit.queryUrl = '/Official/GetSearchFileList' + '?rnd=' +Math.random();
//初始化Table
oTableInit.Init = function () {
$('#table-javascript').bootstrapTable({
method: 'get',
url: oTableInit.queryUrl,
height: $(window).height() - 290,
striped: true,
pagination: true,
singleSelect: false,
pageSize: 2,
pageNumber: 1,
pageList: [10, 50, 100, 200, 500],
search: false, //不显示 搜索框
showColumns: false, //不显示下拉框(选择显示的列)
sidePagination: "server", //服务端请求
queryParams: oTableInit.queryParams,
minimunCountColumns: 2,
queryParamsType: "",//分页参数设置
formatNoMatches: function () {
return '未检索到**信息';
},
columns: [
{
field: 'BH',
title: '序号',
width: 20,
align: 'center',
valign: 'middle',
sortable: false,
}, {
field: 'TITLE',
title: '**名称',
width: 200,
align: 'left',
valign: 'top',
sortable: false,
}, {
field: 'Creater',
title: '创建人',
width: 50,
align: 'left',
valign: 'top',
sortable: false
}, {
field: 'CreateTime',
title: '创建时间',
width: 110,
align: 'middle',
valign: 'top',
sortable: false
}, {
field: 'operate',
title: '操作',
width: 100,
align: 'center',
valign: 'middle',
formatter: operateFormatter,
events: operateEvents
}],
onLoadSuccess: function () {
//layer.msg('加载成功');
},
onLoadError: function () {
layer.msg('未检索到**信息');
}
});
};
//销毁表格
oTableInit.Destory = function () {
$('#table-javascript').bootstrapTable('destroy');
};
//得到查询的参数
oTableInit.queryParams = function (params) {
var temp = {
pageSize: params.pageSize,
pageIndex: params.pageNumber,
Title:$("#Title").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val()
};
return temp;
};
return oTableInit;
};
function operateFormatter(value, row, index) {
return '<a class="detail" style="color:#428bca;cursor:pointer;" >查看</a>';
}
window.operateEvents = {
'click .detail': function (e, value, row, index) {
var url = '@Url.Content("~/**/**?id=")' + row.ID;
window.open(url, '_blank');
}
};
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询