bootstrapTable绑定不出数据,ajax返回的数据如下: 10
"[{"DId":6,"Name":"0","Parent":5,"SoftId":1,"IsDel":false,"CreateTime":"","Num":6},{"...
"[{"DId":6,"Name":"0","Parent":5,"SoftId":1,"IsDel":false,"CreateTime":"","Num":6},{"DId":7,"Name":"4","Parent":5,"SoftId":2,"IsDel":false,"CreateTime":"","Num":7},{"DId":8,"Name":"11","Parent":5,"SoftId":3,"IsDel":false,"CreateTime":"","Num":8}]"或者"{"total";3,"rows";[{"DId":6,"Name":"0","Parent":5,"SoftId":1,"IsDel":false,"CreateTime":"","Num":6},{"DId":7,"Name":"4","Parent":5,"SoftId":2,"IsDel":false,"CreateTime":"","Num":7},{"DId":8,"Name":"11","Parent":5,"SoftId":3,"IsDel":false,"CreateTime":"","Num":8}]}"这样都加载不出来,求解答,在线等。。。。挺急的。。。程序代码如下图。
展开
1个回答
展开全部
你返回的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');
}
};
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询