bootstrap-table无法加载json数据

来源:互联网 发布:淘宝网店学校 编辑:程序博客网 时间:2024/05/16 10:49

bootstrap-table无法加载json数据

问题:可以获取后台传过来的json数据但是无法在table中显示出来
解决方案:添加responseHandler
注意:用json加载数据 table 标签不能写 data-toggle=”table” 属性

<!--list.ejs --> <table id="userlist"></table>
/*list.js*/var tabInit=function () {    var otabInit=new Object();    otabInit.Init=function () {        $('#userlist').bootstrapTable({            url: '/admin/list',         //请求后台的URL(*)            method: 'post',             //请求方式(*)            toolbar: '#toolbar',        //工具按钮用哪个容器            pagination: true,                   //是否显示分页(*)            cache: false,            clickToSelect: true,            showRefresh: true,                  //是否显示刷新按钮            showPaginationSwitch: true,       //是否显示选择分页数按钮            pageNumber: 1,                       //初始化加载第一页,默认第一页            pageSize: 5, //每页的记录行数(*)            search: true,            responseHandler:function (res) {                return res.DATA;            },            uniqueId:'id',            columns: [{                field: 'id',                title: 'id',            }, {                field: 'AccountName',                title: '用户名'            }, {                field: 'CreateTime',                title: '创建时间'            }, {                field: 'AccountState',                title: '状态'            },]        });    }    return otabInit;};

Bootstrap Table的使用小结
bootstrap-table填坑之旅<一>认识bootstrap-table


2 0
原创粉丝点击